argopt
argopt copied to clipboard
Support choices
i.e.: add_argument(choices=...)
Maybe interface could be
--arg ARG : choose from [default: dflt|another|third:[str]]
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"])