-
Notifications
You must be signed in to change notification settings - Fork 1
/
tester.py
executable file
·55 lines (47 loc) · 1.46 KB
/
tester.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from argsparser import ArgValsEnum, ArgsParser
from argsparser.UserError import UserError
def main():
args = ["hello", "-d", "dir1", "dir2", "dir3", "-hcf", "file.py",
"--go", "order", "cheese"]
parser = ArgsParser().addOption("dirs", "d", ArgValsEnum.MANY) \
.addFlag("help", "h").addFlag("cart", "c") \
.addOption("file", "f", ArgValsEnum.ONE).addFlag("go", "g")
tup = parser.parse(*args)
print(tup)
try:
args = ["hello", "-d", "dir1", "dir2", "dir3", "-hfc", "file.py",
"--go", "order", "cheese"]
tup = parser.parse(*args)
print(tup)
except UserError as err:
print(err)
try:
args = ["hello", "-d", "-hcf", "file.py",
"--go", "order", "cheese"]
tup = parser.parse(*args)
print(tup)
except UserError as err:
print(err)
try:
args = ["hello", "-d", "dir1", "dir2", "dir3", "--file", "file", "-hcf",
"file.py", "--go", "order", "cheese"]
tup = parser.parse(*args)
print(tup)
except UserError as err:
print(err)
try:
args = ["hello", "-t", "-d", "dir1", "dir2", "dir3", "-hcf", "file.py",
"--go", "order", "cheese"]
tup = parser.parse(*args)
print(tup)
except UserError as err:
print(err)
try:
args = ["hello", "-d", "dir1", "dir2", "dir3", "-hcf", "file.py",
"--go", "order", "cheese"]
tup = parser.parse(*args)
print(tup)
except UserError as err:
print(err)
if __name__ == "__main__":
main()