File size: 689 Bytes
a221723 1e9fbd8 b93d7b6 187b3b5 729cd7f 6290b91 729cd7f 6290b91 729cd7f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import streamlit as st
import subprocess
import os
command = st.text_input("Command: ", "")
commandList = command.split(' ')
if(len(command) > 0):
if(commandList[0] == "cd"):
os.chdir(commandList[1])
output = subprocess.run(['pwd'], stdout=subprocess.PIPE).stdout.decode('utf-8')
st.write(f"{command}:")
outputList = output.split("\n")
for out in outputList:
st.write(f"{out}")
else:
output = subprocess.run(commandList, stdout=subprocess.PIPE).stdout.decode('utf-8')
st.write(f"{command}:")
outputList = output.split("\n")
for out in outputList:
st.write(f"{out}")
|