In Python one can set the choices for a flag with argparse
:
parser.add_argument('-q',
dest='quality_scale',
type=str,
choices=["sanger", "illumina"],
help='Base quality scale',
required=True)
Is there a way to do this in Julia using ArgParse
? I checked the documentation here (General settings), but I could not find anything.
You can use the range_tester
parameter, which takes a one-argument function, to perform validation on the input value. Something like the following, which will only accept "a"
, "b"
, or "c"
.
s = ArgParseSettings()
@add_arg_table s begin
"--opt"
range_tester = in(["a", "b", "c"])
end