What do you think about this kind of indication for conflicting or otherwise invalid arguments?

With command line arguments being 1D and line length valid up to hundreds of kilobytes only inline indication seems to work.

Would you change anything?

  • manpacket@lemmyrs.orgOP
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    You need to tell the user that this is an error, otherwise they don’t know if it succeeded or not.

    So add “Error:” at the beginning? Looks a bit better, right.

    Last line is more or less copy of the command line user gave with markers indicating bits parser does not like.

    • ActuallyRuben@actuallyruben.nl
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 year ago

      I’d recommend adding the markers on a line below the text, in a similar way to how rust compiler output indicates errors.

      Also WIN isn’t really clear to me what it’s supposed to mean, does it mean that flag “wins” and takes precedence over the other conflicting flag? Does that even matter if the program exits with an error anyway?

      • manpacket@lemmyrs.orgOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        I’d recommend adding the markers on a line below the text, in a similar way to how rust compiler output indicates errors.

        It is easier for the rust compiler to do so since rust files are always valid utf8 and formatted to be of reasonable size. Doing the right thing with OsString is harder, plus lines can be long and trimming it enough that it still fits on a line above all that while also dealing with unicode shenanigans… That’s why I’m trying to do things inline where most of those things

        Also WIN isn’t really clear to me what it’s supposed to mean, does it mean that flag “wins” and takes precedence over the other conflicting flag?

        Right. Wording can use more work :)

        Does that even matter if the program exits with an error anyway?

        Hmm… Interesting question. I guess it is less useful in this case but I can imagine some stranger situations. Plus I’m trying to create more detailed/user friendly error messages - one is text description “FOO is required” and the other one shows place where exactly this “FOO” is required.