You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it's easy to declare flag aliases on a 1:1 basis:
User input
Alias that runs
command --old-flag
command --new-flag
What is the expected behavior?
What I'd like to be able to do is declare flag aliases on a 1:many basis — create a flag that aliases multiple existing flags, to provide users with shortcuts to a sensible set of options:
User input
Aliased flags that run
order --combo
order --burger --fries --shake=strawberry
Purely spitballing, but here's an idea of how I might reasonably expect to configure this:
exportdefaultclassOrderextendsCommand{staticdescription='Place your order';staticflags={burger: Flags.string({/***/}),fries: Flags.boolean({/***/}),shake: Flags.string({/***/}),combo: Flags.boolean({default: false,description: 'The chef’s special :)',groupAlias: [{flag: 'burger'},// flag has default value, therefore no option required{flag: 'fries'},// flag is a boolean, no option required{flag: 'shake',option: 'strawberry'// flag is a string with no default value, so option is required},]}),}}
I think something like this would make it easier to support common use cases and workflows, while preserving composability and granularity for power users. Thanks!
The text was updated successfully, but these errors were encountered:
We've been considering adding a preparse hook that would allow people to manipulate the raw flags and args before they're parsed. I think such a feature would be able to support your idea. Essentially you would see if --combo is present and then add the other flags to the set of flags that will be parsed.
Implementing that feature is behind a few things other things on our roadmap so I'll keep this feature request open in the meantime
Do you want to request a feature or report a bug?
Feature request!
What is the current behavior?
Currently, it's easy to declare flag aliases on a 1:1 basis:
command --old-flag
command --new-flag
What is the expected behavior?
What I'd like to be able to do is declare flag aliases on a
1:many
basis — create a flag that aliases multiple existing flags, to provide users with shortcuts to a sensible set of options:order --combo
order --burger --fries --shake=strawberry
Purely spitballing, but here's an idea of how I might reasonably expect to configure this:
I think something like this would make it easier to support common use cases and workflows, while preserving composability and granularity for power users. Thanks!
The text was updated successfully, but these errors were encountered: