| 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}") | |