Currently, PassAfterNonOption is a Parser flag. This means that it
applies to all commands. Sometimes it's desirable have this behavior on
only a subset of commands. For instance, for restart subcommand, we
would like the default behavior of parsing both -v and --wait flags:
mycmd restart -v foo bar --wait
But for exec subcommand, we want only the -v flag to be parsed. The -l
flag should be treated as positional argument.
mycmd exec -v ls -l /
Introduce PassAfterNonOption boolean field in Command structure that has
the same meaning as the flag in Parser but applies only to the currently
active command. The field can be set by adding pass-after-non-option tag
to data structure declaration.
This only allows to selectively enable the behavior in commands when
PassAfterNonOption Parser flag is unset. When the flag is set, the
behavior is enabled for all commands and cannot be disabled by false
value of PassAfterNonOption field. This is to keep the code simple and
backwards compatible (since PassAfterNonOption field defaults to false).
Currently, PassAfterNonOption is a Parser flag. This means that it applies to all commands. Sometimes it's desirable have this behavior on only a subset of commands. For instance, for restart subcommand, we would like the default behavior of parsing both -v and --wait flags:
mycmd restart -v foo bar --wait
But for exec subcommand, we want only the -v flag to be parsed. The -l flag should be treated as positional argument.
mycmd exec -v ls -l /
Introduce PassAfterNonOption boolean field in Command structure that has the same meaning as the flag in Parser but applies only to the currently active command. The field can be set by adding pass-after-non-option tag to data structure declaration.
This only allows to selectively enable the behavior in commands when PassAfterNonOption Parser flag is unset. When the flag is set, the behavior is enabled for all commands and cannot be disabled by false value of PassAfterNonOption field. This is to keep the code simple and backwards compatible (since PassAfterNonOption field defaults to false).