forked from legion1581/go2_firmware_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
47 lines (39 loc) · 1.14 KB
/
main.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
import os
import logging
from InquirerPy import inquirer
from firmware import firmware
from network import network
from device import device
# Configure basic logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(levelname)s - %(message)s')
# Get the logger
logger = logging.getLogger('go2_firmware_tools')
logger.setLevel(logging.WARNING)
# Ensure that the root logger has the correct level
logging.getLogger().setLevel(logging.WARNING)
def main_menu():
menu_items = [
'Device',
'Firmware',
'Network',
'Quit'
]
choice = inquirer.select(
message="Select an option:",
choices=menu_items
).execute()
return choice
if __name__ == '__main__':
main_py_dir = os.path.dirname(os.path.abspath(__file__))
device.device_management.device_init(main_py_dir)
while True:
choice = main_menu()
if choice == 'Firmware':
firmware.cli_handler()
elif choice == 'Device':
device.cli_handler()
elif choice == 'Network':
network.cli_handler()
elif choice == 'Quit':
break