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

An equal sign is required before the argument's value #97

Open
kuraga opened this issue May 24, 2023 · 2 comments
Open

An equal sign is required before the argument's value #97

kuraga opened this issue May 24, 2023 · 2 comments
Assignees

Comments

@kuraga
Copy link

kuraga commented May 24, 2023

An equal sign is required before the argument's value.

For example, pkgcheck scan --help says:

  -c CHECK[,-CHECK,+CHECK,...], --checks CHECK[,-CHECK,+CHECK,...]
                        limit checks to run

but

pkgcheck scan --checks "-VisibilityCheck"
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/snakeoil/cli/arghparse.py", line 1248, in parse_known_args
    namespace, args = functor(parser, namespace, args)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkgcheck/scripts/pkgcheck_scan.py", line 375, in _setup_scan
    namespace, _ = parser._parse_known_args(args, namespace)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/argparse.py", line 2114, in _parse_known_args
    start_index = consume_optional(start_index)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/argparse.py", line 2044, in consume_optional
    arg_count = match_argument(action, selected_patterns)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/argparse.py", line 2208, in _match_argument
    raise ArgumentError(action, msg)
argparse.ArgumentError: argument -c/--checks: expected one argument
pkgcheck scan: error: argument -c/--checks: expected one argument

while

pkgcheck scan --checks="-VisibilityCheck"

is OK.

pkgcheck 0.10.24
snakeoil 0.10.5

@thesamesam
Copy link
Member

Note that it's only when there's -value.

@arthurzam
Copy link
Member

I'm not sure if we can fix it, since this part of the behavior of argparse inside. I'm also not sure if I can fix the format it shows the help (notice that it doesn't mention the = format) since this also uses the builtin format.

@arthurzam arthurzam self-assigned this May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants