8000 Support choices · Issue #12 · casperdcl/argopt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support choices #12

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

Open
casperdcl opened this issue Jul 4, 2020 · 1 comment
Open

Support choices #12

casperdcl opened this issue Jul 4, 2020 · 1 comment
Assignees

Comments

@casperdcl
Copy link
Owner
casperdcl commented Jul 4, 2020

i.e.: add_argument(choices=...)

Maybe interface could be

--arg ARG  : choose from [default: dflt|another|third:[str]]
@casperdcl casperdcl self-assigned this Jul 4, 2020
@Freed-Wu
Copy link

However, argparse allow user to use different type in choices, such as:

from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("--arg", choices = ["a", 1])

So, it may be:

--arg ARG: choose from [default: 1|a:[int:str]]

And

--arg ARG: choose from [default: 1|a:[str]]

should be recognized as

from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("--arg", choices = ["a", "1"])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
44BF
Projects
None yet
Development

No branches or pull requests

2 participants
0