We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af4cda4 commit 8c3613bCopy full SHA for 8c3613b
1 file changed
CoreShell/main.py
@@ -0,0 +1,33 @@
1
+import os
2
+import importlib
3
+from bin import *
4
+import colours
5
+
6
+home = os.getcwd()
7
8
+validCmds = []
9
10
+def execute_command(cmd, args):
11
+ try:
12
+ command_func = globals().get(cmd) or importlib.import_module(f"bin.{cmd}")
13
+ output = command_func(args)
14
+ return output
15
+ except Exception as e:
16
+ return f"Error: {e}"
17
18
+while True:
19
+ wd=""
20
+ cmd=""
21
+ base=""
22
+ args=""
23
24
+ wd = os.getcwd()
25
+ cmd = input(wd + colours.magenta() + " ~ € " + colours.reset())
26
+ base = cmd.split(" ")[0]
27
+ args = cmd.split(" ")[1:]
28
+ if base not in globals() and not hasattr(importlib.import_module('bin'), base):
29
+ print("Command not found.")
30
+ else:
31
+ output = execute_command(base, args)
32
+ if output not in [0, None]:
33
+ print(output)
0 commit comments