-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.py
More file actions
45 lines (41 loc) · 1.23 KB
/
shell.py
File metadata and controls
45 lines (41 loc) · 1.23 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
import basic
import os
import subprocess
while True:
text = input('Doge shell 0.1 (Beta) > ')
if "import" in text:
importing = text.split(" ")
if importing[0] == "import":
f = open(importing[1], 'r')
imports = f.read()
f2 = open(importing[2], 'r')
toimp = f2.read()
aimp = imports + "\n" + toimp
print(aimp)
f2 = open(importing[2], 'w')
f2.truncate()
f2.write(aimp)
f2.close()
f.close()
else:
if text.strip() == "":
continue
result, error = basic.run('<stdin>', text)
if error:
print(error.as_string())
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
print(repr(result))
else:
if text.strip() == "":
continue
result, error = basic.run('<stdin>', text)
if error:
print(error.as_string())
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
print(repr(result))