forked from bedroombuilds/python2rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathargp.py
More file actions
30 lines (24 loc) · 984 Bytes
/
argp.py
File metadata and controls
30 lines (24 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import argparse
from enum import Enum
class Categories(Enum):
Science = 28
People = 22
Comedy = 23
VALID_CATEGORIES = [c.name for c in Categories]
if __name__ == '__main__':
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--file', required=True, help='Video file to upload')
parser.add_argument('--title', help='Video title')
parser.add_argument('--category',
choices=VALID_CATEGORIES,
default='Science',
help='video category.')
parser.add_argument('--verbose', action='store_true', help='show more output')
parser.add_argument('-n',
'--name',
dest='names',
action='append',
help="provides names to greet")
args = parser.parse_args()
args.category = Categories.__getitem__(args.category)
print(args)