Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support per-command PassAfterNonOption #393

Merged
merged 1 commit into from
Jun 15, 2024
Merged

Commits on Jan 19, 2023

  1. Support per-command PassAfterNonOption

    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).
    woky committed Jan 19, 2023
    Configuration menu
    Copy the full SHA
    6c1df9d View commit details
    Browse the repository at this point in the history