Skip to content

Commit 21d6f5d

Browse files
committed
Added usage
1 parent c1ca28e commit 21d6f5d

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

expand.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,30 @@
33
import sys
44
import getopt
55

6-
opt_list = ['output-comment', 'output-test', ]
6+
usage = '''Usage:expand.py [options] <output modules>
7+
Output Modules:
8+
convolution
9+
dsu
10+
fenwicktree
11+
lazysegtree
12+
math
13+
maxflow
14+
mincostflow
15+
modint
16+
scc
17+
segtree
18+
string
19+
twosat
20+
21+
You can select multiple modules for <output modules>
22+
e.g.)expand.py math segtree
23+
24+
Options:
25+
-c --output_comment output comment
26+
-t --output_test output test code
27+
-h --help print help
28+
'''
29+
opt_list = ['output-comment', 'output-test', 'help']
730
output_list_all = ('lazysegtree', 'segtree', 'convolution', 'twosat', 'scc',
831
'fenwicktree', 'math', 'modint', 'maxflow', 'dsu', 'mincostflow', 'string', 'internal_bit', 'internal_math', 'internal_type_traits', 'internal_scc', 'internal_queue')
932
dependency_list = {'lazysegtree': ('internal_bit',), 'segtree': ('internal_bit',), 'convolution': ('internal_bit,modint',), 'math': ('internal_math',), 'modint': (
@@ -34,9 +57,10 @@ def output_file(filename, output_comment, output_test):
3457

3558

3659
try:
37-
opts, args = getopt.getopt(sys.argv[1:], 'tc', opt_list)
60+
opts, args = getopt.getopt(sys.argv[1:], 'tch', opt_list)
3861
except getopt.GetoptError as e:
3962
print(e)
63+
print(usage)
4064
sys.exit(2)
4165

4266
output_comment = False
@@ -47,13 +71,17 @@ def output_file(filename, output_comment, output_test):
4771
output_comment = True
4872
if o == '--output-test' or o == '-t':
4973
output_test = True
74+
if o == '--help' or o == '-h':
75+
print(usage)
76+
sys.exit(0)
5077

5178
output_list = set()
5279

5380
while len(args) != 0:
5481
pop = args.pop()
5582
if not pop in output_list_all:
5683
print('invalid args:{}'.format(pop))
84+
print(usage)
5785
sys.exit(2)
5886
output_list.add(pop)
5987
if pop in dependency_list:

0 commit comments

Comments
 (0)