jwaldrip / admiral.cr

A robust DSL for writing command line interfaces written in Crystal.
https://jwaldrip.github.com/admiral.cr
MIT License
135 stars 14 forks source link

Added 'default_in_desc' parameter to `define_flag` #8

Closed Jens0512 closed 6 years ago

Jens0512 commented 6 years ago

Added 'default_in_desc' parameter to define_flag, that specifies whether to put the default value or not in its description. This is mainly because I think it didn't make very much sense to show to the default for, e.g. --help. See the example I added for usage.

In my opinion:

Flags:
  --help, -h              # Displays help for the current command.
  --print-why             # Prints why
  --why (default: 42...)

Where print-why is defined like this:

define_flag print_why : Bool, default: false, default_in_desc: false, description: "Prints why"

Makes much more sense than this:

Flags:
  --help, -h (default: false)         # Displays help for the current command.
  --print-why (default: false)         # Prints why
  --why (default: 42...)

However, what I am not so sure about is the name of the option 'default_in_desc', any better name would be greatly appreciated, as I am not a native english speaker.

If you people here do not have anything against this, I can add info on this option in the readme.

jwaldrip commented 6 years ago

Would it not make more sense to just not show booleans as defaults at all?