-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
89 lines (53 loc) · 1.37 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
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
# Licensed under the MIT license.
# For more information, check the license command.
### Modules ###
from time import sleep
from json import loads
from system import login
from system import setup
from datetime import date
from CLI.parser import parse
from colors import colored, color
from system import initialize
from render import load, clear
### System ###
def startSystem(doBoot=True):
if doBoot:
### Variables ###
REQ_FIRST_TIME_SETUP = False
### Booting Screen ###
load()
print(open("icons/bootLogo.txt", "r").read())
sleep(1.2)
### Initialization ###
REQ_FIRST_TIME_SETUP = initialize(REQ_FIRST_TIME_SETUP)
clear()
if REQ_FIRST_TIME_SETUP:
setup()
config = loads(open("data/os.json", "r").read())
### Begin Login ###
username, password = login(config)
sleep(2)
### Dashboard ###
clear()
print(
colored(
f"OofOS v{config['version']} | User: {username} | {date.today()}",
"green"))
print()
while True:
try:
cmd = input(
f"{colored(f'{username}@oofosServer', 'yellow')} {colored('$', 'green')} {color('green')}"
)
except KeyboardInterrupt:
cmd = ""
print(
"\n\nIgnoring exit key; in the future this will terminate ZealousOS.\n"
)
args = None
if " " in cmd:
args = cmd.split(" ")[1:]
cmd = cmd.split(" ")[0]
parse(cmd, args, config, startSystem)
startSystem()