Open weitzman opened 8 years ago
I'm envisioning @allowed-values argument/option-name [value1|value2|...]
. For example
@allowed-values status enabled|disabled
I cant find any standard for delimiting multiple values beside pipe which is often used in the value of @return annotation.
Or we could optionally turn options/params into an array like field-labels. So,
@option status Filter Views to a given status. Allowed values are enabled, disabled.
hidden: true
allowed-values: enabled,disabled
FYI, I implemented @hidden-option annotation in \Drush\CommandFiles\core\DrupliconCommands and twice in the annotation_adapter.inc
This indeed would be a create feature! In addition to the proposal: https://github.com/consolidation/annotated-command/issues/53#issuecomment-252643688
it would be very useful to be able to specify a callback that could return options.
The other thing that is related to this is that Symfony Console has a paradigm for using the "interact" method, or @hook interact
in annotated command, to allow tools to prompt for input to fill in values for required options that were not provided on the command line.
If an option can only take one of a set of predefined options, it would make sense for the tool to give the user a multi-select menu in hook interact to let them easily fill in this value.
If there was a way to stipulate what the allowed values were, it might also make sense to have an annotation that indicated that the value should be prompted for, and just do it for the user.
The new attributes feature has started using https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/#expectedvalues in #223. Leaving open for the interact idea.
Would be handy if the list if allowed values could be given in an annotation for options and arguments. See \Drush\CommandFiles\core\ViewsCommands::vlist (status option), for example.