Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,17 @@ import os
|
|
6 |
command = st.text_input("Command: ", "")
|
7 |
commandList = command.split(' ')
|
8 |
|
9 |
-
if(
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
command = st.text_input("Command: ", "")
|
7 |
commandList = command.split(' ')
|
8 |
|
9 |
+
if(len(command) > 0):
|
10 |
+
if(commandList[0] == "cd"):
|
11 |
+
os.chdir(commandList[1])
|
12 |
+
output = subprocess.run(['pwd'], stdout=subprocess.PIPE).stdout.decode('utf-8')
|
13 |
+
st.write(f"{command}: \n {output}")
|
14 |
+
outputList = output.split("\n")
|
15 |
+
for out in outputList:
|
16 |
+
st.write(f"{out}")
|
17 |
+
else:
|
18 |
+
output = subprocess.run(commandList, stdout=subprocess.PIPE).stdout.decode('utf-8')
|
19 |
+
st.write(f"{command}: \n {output}")
|
20 |
+
outputList = output.split("\n")
|
21 |
+
for out in outputList:
|
22 |
+
st.write(f"{out}")
|