-
Notifications
You must be signed in to change notification settings - Fork 0
/
grouped_action_flags.py
52 lines (35 loc) · 1.16 KB
/
grouped_action_flags.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
#!/usr/bin/env python
from cli_command_parser import Command, main, ParamGroup, before_main, after_main
class GroupedFlags(Command, show_group_tree=True):
with ParamGroup(mutually_exclusive=True):
@before_main('-a', order=1)
def action_a(self):
print('a')
@before_main('-b', order=2)
def action_b(self):
print('b')
with ParamGroup(mutually_dependent=True):
@before_main('-c', order=3)
def action_c(self):
print('c')
@before_main('-d', order=4)
def action_d(self):
print('d')
with ParamGroup(mutually_dependent=True):
@after_main('-w', order=1)
def action_w(self):
print('w')
@after_main('-x', order=2)
def action_x(self):
print('x')
with ParamGroup(mutually_exclusive=True):
@after_main('-y', order=3)
def action_y(self):
print('y')
@after_main('-z', order=4)
def action_z(self):
print('z')
def main(self):
print('main')
if __name__ == '__main__':
main()