Debian Codegraph @

doc/samples/parameters.py

raw symbols SCIP
1 def task_py_params():
2 def show_params(param1, param2):
3 print(param1)
4 print(5 + param2)
5 return {'actions':[(show_params,)],
6 'params':[{'name':'param1',
7 'short':'p',
8 'default':'default value'},
9
10 {'name':'param2',
11 'long':'param2',
12 'type': int,
13 'default':0}],
14 'verbosity':2,
15 }
16
17 def task_py_params_list():
18 def print_a_list(list):
19 for item in list:
20 print(item)
21 return {'actions':[(print_a_list,)],
22 'params':[{'name':'list',
23 'short':'l',
24 'long': 'list',
25 'type': list,
26 'default': [],
27 'help': 'Collect a list with multiple -l flags'}],
28 'verbosity':2,
29 }
30
31 def task_py_params_choice():
32 def print_choice(choice):
33 print(choice)
34
35 return {'actions':[(print_choice,)],
36 'params':[{'name':'choice',
37 'short':'c',
38 'long': 'choice',
39 'type': str,
40 'choices': (('this', ''), ('that', '')),
41 'default': 'this',
42 'help': 'Choose between this and that'}],
43 'verbosity':2,}
44
45 def task_cmd_params():
46 return {'actions':["echo mycmd %(flag)s xxx"],
47 'params':[{'name':'flag',
48 'short':'f',
49 'long': 'flag',
50 'default': '',
51 'help': 'helpful message about this flag'}],
52 'verbosity': 2
53 }
54