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

--branch is too greedy, causing it to consume positional arguments #178

Open
typecasto opened this issue Mar 14, 2022 · 1 comment
Open

Comments

@typecasto
Copy link

I'm trying to run assigner get --branch main hw1, but I'm getting the following error:

usage: assigner get [-h] [--branch BRANCH [BRANCH ...]] [-f] [--section [SECTION]] [--student id] [--attempts ATTEMPTS] name [path]
assigner get: error: the following arguments are required: name

I suspect this is a result of --branch taking multiple arguments, and being greedy in consuming those arguments, causing it to interpret my command as (assigner) (get) (--branch main hw1) (*missing positional parameter*). I suggest making --branch take a single argument, and allow it to be specified multiple times instead. This would alleviate the ambiguity in parsing positional arguments.

@BehindTheBrain
Copy link

I'm assuming this is true of any argparse with multiple, like commit -a commit -r as well. We can at least note that one should include the assignment name before these, which does work well enough.

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

2 participants