-
Notifications
You must be signed in to change notification settings - Fork 0
/
linuxp.py
139 lines (99 loc) 路 3.25 KB
/
linuxp.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env python
import argparse
from linux_profile.base.command import BaseCommand, Command
from linux_profile.commands.account import Account
from linux_profile.commands.add import Add
from linux_profile.commands.config import Config
from linux_profile.commands.profile import Profile
from linux_profile.commands.execute import Execute
from linux_profile.commands.install import Install
from linux_profile.commands.uninstall import Uninstall
from linux_profile.commands.list import List
from linux_profile.commands.remove import Remove
class CommandConfig(Command):
def execute(self):
"""Start"""
Config(**self.arguments.__dict__)
class CommandProfile(Command):
def execute(self):
"""Start"""
Profile(**self.arguments.__dict__)
class CommandAdd(Command):
def execute(self) -> None:
"""Start"""
Add(**dict(module=self.module))
class CommandRemove(Command):
def execute(self) -> None:
"""Start"""
Remove(**dict(id=self.id))
class CommandExecute(Command):
def execute(self) -> None:
"""Start"""
Execute(**dict(id=self.id))
class CommandInstall(Command):
def execute(self) -> None:
"""Start"""
Install(
**dict(
sudo=self.sudo,
debug=self.debug,
module=self.module,
tag=self.tag,
item=self.item,
group=self.group,
args=self.args
)
)
class CommandUninstall(Command):
def execute(self) -> None:
"""Start"""
Uninstall(
**dict(
sudo=self.sudo,
debug=self.debug,
module=self.module,
tag=self.tag,
item=self.item,
group=self.group,
args=self.args
)
)
class CommandList(Command):
def execute(self) -> None:
"""Start"""
List(
**dict(
module=self.module,
tag=self.tag,
item=self.item,
field=self.field,
print=self.print
)
)
class CommandAccount(Command):
def execute(self):
"""Start"""
Account(**self.arguments.__dict__)
class BuildCommand:
base_command = BaseCommand
def __init__(self) -> None:
parser = argparse.ArgumentParser(description='馃惂 Linux Profile Management CLI Tool')
self.command = self.base_command(parser)
self.core_commands()
self.command.run()
def core_commands(self):
self.command.cmd_config.set_defaults(exec=CommandConfig)
self.command.cmd_profile.set_defaults(exec=CommandProfile)
self.command.cmd_add.set_defaults(exec=CommandAdd)
self.command.cmd_remove.set_defaults(exec=CommandRemove)
self.command.cmd_execute.set_defaults(exec=CommandExecute)
self.command.cmd_install.set_defaults(exec=CommandInstall)
self.command.cmd_uninstall.set_defaults(exec=CommandUninstall)
self.command.cmd_list.set_defaults(exec=CommandList)
self.setup()
def setup(self) -> str:
return "Method not Implemented"
def main():
BuildCommand()
if __name__ == '__main__':
main()