dry-cli icon indicating copy to clipboard operation
dry-cli copied to clipboard

More powerful options

Open noraj opened this issue 11 months ago • 2 comments

Flags

options are always considered having a value --mode=http2 or --mode http2.

  • [ ] Having flags (options without value)

E.g. just having --color, having the flag equals options.fetch(:color) returning true, not having the flag equals options.fetch(:color) returning false. It's better than having --color true and --color false with values: %w[true false] and casting the string to a boolean.

Aliases

It would be nice to have has many aliases as we want for an option.

  • [ ] Having aliases

E.g. -c, --color or --color, --colour.

It's often handy to have long flags that are mnemotechnic and short flags for those familiar with the tool that want to type faster.

Mutually exclusive

Sometimes it is required to have mutually exclusive options, see #128.

  • [ ] Having mutually exclusive options #128

Casting type

As passed from the CLI, all values are strings, so it would be handy to have cast types for options.

  • [ ] Having cast types

E.g. --age 21 or --advanced true. It's allows to cast type in the definition of the option, avoiding forgetting to cast it when the value is retrieved or to cast it several times if the option is used at multiple places.

noraj avatar Jul 20 '23 14:07 noraj