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

Modify option for list type? #2

Open

Description

@adehecq

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions