-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.py
More file actions
68 lines (55 loc) · 1.83 KB
/
interface.py
File metadata and controls
68 lines (55 loc) · 1.83 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
56
57
58
59
60
61
62
63
64
65
66
67
68
import importlib.util
import os
import time
import sys
def load_core():
global Critical
global Utils
plankcore_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "plankcore.py")
if os.path.exists(plankcore_path):
spec = importlib.util.spec_from_file_location("plankcore", plankcore_path)
plankcore = importlib.util.module_from_spec(spec)
spec.loader.exec_module(plankcore)
Critical = plankcore.Critical
Utils = plankcore.Utils
else:
print("plankcore.py not found!")
class Cli:
def Loop():
while True:
Cli.Input()
Cli.Processcommand()
def Input():
global Command
Command = input("Plank$> ")
def Processcommand():
if Command == "help":
Commands.Help()
if Command == "info":
Commands.Info()
if Command == "force panic":
Commands.Force_Panic()
if Command == "program":
Commands.Run_Program()
class Commands:
def Help():
load_core()
Critical.Outp("Help")
Critical.Outp("Info")
Critical.Outp("Force Panic")
Critical.Outp("Program")
def Info():
load_core()
Critical.Outp("System: Plank kernel")
Critical.Outp("Software Manufacturer: ADW Systems")
Critical.Outp("Version: Beta 0.1.5")
def Force_Panic():
load_core()
Utils.Panic("User_Forced_Panic")
time.sleep(3)
sys.exit()
def Run_Program():
InpProgram = input("Program name: ")
current_dir = os.getcwd()
interpreter_path = os.path.join(current_dir, "appdata", "sep", "interpreter.py")
os.system(f"python {interpreter_path} \"{InpProgram}\"")