2
0
mirror of https://github.com/Shawn-Shan/fawkes.git synced 2024-12-22 07:09:33 +05:30

Use argparse choices param

This commit is contained in:
Eitan Simler 2020-08-04 21:43:48 -07:00
parent 2b08b3ec8e
commit e2d4625325

View File

@ -194,13 +194,12 @@ def main(*argv):
action='store_true') action='store_true')
parser.add_argument('--debug', help="turn on debug and copy/paste the stdout when reporting an issue on github", parser.add_argument('--debug', help="turn on debug and copy/paste the stdout when reporting an issue on github",
action='store_true') action='store_true')
parser.add_argument('--format', type=str, parser.add_argument('--format', type=str, choices=('png', 'jpg', 'jpeg'),
help="format of the output image", help="format of the output image",
default="png") default="png")
args = parser.parse_args(argv[1:]) args = parser.parse_args(argv[1:])
assert args.format in ['png', 'jpg', 'jpeg']
if args.format == 'jpg': if args.format == 'jpg':
args.format = 'jpeg' args.format = 'jpeg'