Skip to content
This repository has been archived by the owner on Sep 25, 2021. It is now read-only.

Modify option for list type? #2

Open
adehecq opened this issue Nov 27, 2020 · 0 comments
Open

Modify option for list type? #2

adehecq opened this issue Nov 27, 2020 · 0 comments

Comments

@adehecq
Copy link

adehecq commented Nov 27, 2020

First, great tool! I was looking for something exactly like this for a long time and I was happy to find this.
I would like to know: would it be possible to have a different setup for list arguments? Right now, it requires calling the argument as many times as elements in the list (e.g. --my_list 1 --my_list 2 etc) which can be cumbersome for long list or long argument names. Another option would be to use the nargs option. I tested it and it works by modifying a few lines:
At

action = _parser.add_argument(name, action=action_name)
replace by:
action = _parser.add_argument(name, action=action_name, nargs=nargs)

with nargs set to 1 by default, and to '+' if annotation is iterable, here:

action_name = "append"

Let me know if you consider implementing it, otherwise, I'll fork the repository, but I would prefer to stick to this repo if I can since it can be easily installed with pip.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant