File tree Expand file tree Collapse file tree 4 files changed +164
-0
lines changed
Expand file tree Collapse file tree 4 files changed +164
-0
lines changed Original file line number Diff line number Diff line change 1+ from click import group
2+
3+ from .cli .builder import Builder
4+ from .cli .manager import Manager
5+
6+
7+ @group ()
8+ def cli () -> None :
9+ pass
10+
11+ cli .add_command (Builder ())
12+ cli .add_command (Manager ())
13+
14+
15+ def main () -> None :
16+ cli ()
17+
18+
19+ if __name__ == "__main__" :
20+ main ()
Original file line number Diff line number Diff line change 1+ import inspect
2+
3+ from click import Command , Option
4+ from InquirerPy import inquirer
5+ from InquirerPy .validator import EmptyInputValidator
6+
7+ from .custom_group import CustomGroup
8+
9+
10+ class Builder (CustomGroup ):
11+
12+ def __init__ (self ) -> None :
13+ super ().__init__ ()
14+
15+ def create (self ) -> Command :
16+
17+ help = ""
18+ options = [
19+ Option ()
20+ ]
21+
22+ def callback () -> None :
23+ pass
24+
25+ return Command (
26+ name = inspect .currentframe ().f_code .co_name , # type: ignore
27+ help = help ,
28+ callback = callback ,
29+ params = options # type: ignore
30+ )
31+
32+ def update (self ) -> Command :
33+
34+ help = ""
35+ options = [
36+ Option ()
37+ ]
38+
39+ def callback () -> None :
40+ pass
41+
42+ return Command (
43+ name = inspect .currentframe ().f_code .co_name , # type: ignore
44+ help = help ,
45+ callback = callback ,
46+ params = options # type: ignore
47+ )
Original file line number Diff line number Diff line change 1+ import inspect
2+
3+ from click import Group , Command
4+
5+
6+ class CustomGroup (Group ):
7+
8+ def __init__ (self ) -> None :
9+ super ().__init__ ()
10+ self .__register_commands ()
11+
12+ def __register_commands (self ) -> None :
13+ for _ , method in inspect .getmembers (self , predicate = inspect .ismethod ):
14+ result = method ()
15+ if isinstance (result , Command ):
16+ self .add_command (result )
Original file line number Diff line number Diff line change 1+ import inspect
2+
3+ from click import Command , Option
4+ from InquirerPy import inquirer
5+ from InquirerPy .validator import EmptyInputValidator
6+
7+ from .custom_group import CustomGroup
8+
9+
10+ class Manager (CustomGroup ):
11+
12+ def __init__ (self ) -> None :
13+ super ().__init__ ()
14+
15+ def bakcup (self ) -> Command :
16+
17+ help = ""
18+ options = [
19+ Option ()
20+ ]
21+
22+ def callback () -> None :
23+ pass
24+
25+ return Command (
26+ name = inspect .currentframe ().f_code .co_name , # type: ignore
27+ help = help ,
28+ callback = callback ,
29+ params = options # type: ignore
30+ )
31+
32+ def delete (self ) -> Command :
33+
34+ help = ""
35+ options = [
36+ Option ()
37+ ]
38+
39+ def callback () -> None :
40+ pass
41+
42+ return Command (
43+ name = inspect .currentframe ().f_code .co_name , # type: ignore
44+ help = help ,
45+ callback = callback ,
46+ params = options # type: ignore
47+ )
48+
49+ def start (self ) -> Command :
50+
51+ help = ""
52+ options = [
53+ Option ()
54+ ]
55+
56+ def callback () -> None :
57+ pass
58+
59+ return Command (
60+ name = inspect .currentframe ().f_code .co_name , # type: ignore
61+ help = help ,
62+ callback = callback ,
63+ params = options # type: ignore
64+ )
65+
66+ def stop (self ) -> Command :
67+
68+ help = ""
69+ options = [
70+ Option ()
71+ ]
72+
73+ def callback () -> None :
74+ pass
75+
76+ return Command (
77+ name = inspect .currentframe ().f_code .co_name , # type: ignore
78+ help = help ,
79+ callback = callback ,
80+ params = options # type: ignore
81+ )
You can’t perform that action at this time.
0 commit comments