Skip to content

Offer ability to short circuit help output (Ex: -h) #30

Description

@Boscop

Currently, passing -h doesn't work:

Unrecognized argument: -h

Passing -h should work the same as --help, unless one of the options/switches uses short = 'h'.


And in the Usage output, it would then show

-h, --help display usage information

instead of just

--help display usage information

Activity

  1. Boscop commented on Jul 3, 2020

    @Boscop
    Author

    Alternatively, to let the programmer decide (because maybe they want to use -h for something else),
    there should be a way to manually call the function that prints the usage information (that's called when --help is passed).
    So that it can be manually called when -h is passed with an explicit #[argh(switch, short = 'h')] help: bool field.

    I.e. this function:

    pub(crate) fn help(

    But wrapped in a nicer way, callable as a method on the struct that FromArgs is derived on.

  2. benbrittain commented on Jul 3, 2020

    @benbrittain
    Contributor

    I'd be far more amicable to that change! That seems like a good option for those that want -h support

  3. changed the title [-]Arg -h should work the same as --help[/-] [+]Offer ability to short circuit help output[/+] on Jul 10, 2020
  4. changed the title [-]Offer ability to short circuit help output[/-] [+]Offer ability to short circuit help output (Ex: -h)[/+] on Jul 10, 2020
  5. msrd0 commented on Aug 25, 2020

    @msrd0

    I'd also like to see an -h shorthand flag, and I'd be willing to create a PR. However, I am concerned that letting the user implement the shorthand and argh worry about the long flag, the help would end up looking something like that:

    Options:
      -h                display usage information
      --help            display usage information
    

    Therefore, I think either the user should be given the option to specify a shorthand for the help message, or be able to "replace" the help switch altogether. Let me know what you think.

  6. benbrittain commented on Aug 29, 2020

    @benbrittain
    Contributor

    oh interesting, yes that makes sense. I'm open to a change like that!

  7. icefoxen commented on Sep 20, 2020

    @icefoxen

    Agreed on the -h shorthand flag. As for anything else, I don't want programmers to decide that -h should mean anything else, I want it to just be always a shorthand for --help.

  8. aminya commented on Sep 1, 2021

    @aminya
    Contributor

    I made a pull request that fixes this issue #106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions