argopt icon indicating copy to clipboard operation
argopt copied to clipboard

Support choices

Open casperdcl opened this issue 5 years ago • 1 comments

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

Maybe interface could be

--arg ARG  : choose from [default: dflt|another|third:[str]]

casperdcl avatar Jul 04 '20 23:07 casperdcl

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"])

Freed-Wu avatar Aug 17 '22 01:08 Freed-Wu