forked from canadaluke888/TerminalTableBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (34 loc) · 1.42 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
from rich.console import Console
from message_panel.message_panel import MessagePanel
from table_builder.table_builder import TableBuilder
from settings.settings import Settings
from autocomplete.autocomplete import Autocomplete
from database.database import Database
console = Console()
message_panel = MessagePanel(console)
autocomplete = Autocomplete(console)
settings = Settings(console)
database = Database(console)
def main():
"""
Start main application loop.
"""
message_panel.print_welcome_message()
while True:
main_menu_command = console.input("[bold red]Main Menu[/] - [bold yellow]Enter a command[/]: ").lower().strip()
if main_menu_command == "table builder":
table_builder = TableBuilder(console, settings, database)
table_builder.launch_builder()
elif main_menu_command == "database":
database.launch_database()
elif main_menu_command == "settings":
settings.launch_settings()
elif main_menu_command == "help":
message_panel.print_main_menu_instructions()
elif main_menu_command == "exit":
break
else:
message_panel.create_error_message("Inavalid input.")
autocomplete.suggest_command(main_menu_command, autocomplete.main_menu_commands)
if __name__ == "__main__":
main()