-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (46 loc) · 1.28 KB
/
main.py
File metadata and controls
55 lines (46 loc) · 1.28 KB
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
#!/path/to/venv/bin/python
import traceback
from signaler import Signaler
import sys
def exec_command(sig: Signaler):
if len(sys.argv) == 1:
command = "--cancel"
else:
command = sys.argv[1]
match command:
case "--cancel":
return [sig.cancel]
case "--base":
return [sig.base]
case "--therm":
return [sig.thermals]
case "--disks":
return [sig.disks_mounts]
case "--space":
return [sig.disks_spaces]
case "--all":
return [sig.base, sig.thermals, sig.disks_mounts, sig.disks_spaces]
case "--clr":
return [sig.clear_all]
case "--reboot":
return [sig.reboot]
case "--halt":
return [sig.halt]
case "--err":
return [sig.tty_error]
case "--ok":
return [sig.tty_success]
case "--help":
return [sig.help]
def main():
try:
sig = Signaler()
actions = exec_command(sig)
for action in actions:
#print(action)
action()
sys.exit(0)
except Exception as e:
print(f"Invalid command, use --command. {e}")
sys.exit(1)
main()