Update 'shell.py'

This commit is contained in:
JaydenMW 2021-02-16 21:48:31 +01:00
parent 64176b7039
commit 94ff8842fb
1 changed files with 11 additions and 4 deletions

View File

@ -4,7 +4,6 @@ import subprocess
import psutil
import platform
import socket
import getpass
# Get System Information
RAM = psutil.virtual_memory()
@ -12,7 +11,10 @@ CPU = platform.processor()
OS = os_name = platform.system()
# Shell Version
VER = "PCLISH v0.0.3.8a"
VER = "PCLISH v0.0.4a"
# Configuration
PROMPT = "shell@localhost"
# Command Interpretation -- This is the core of the shell
def execute_command(command):
@ -64,6 +66,10 @@ def pclish_echo():
txt = input("What would you like to echo?:\n")
print(txt)
def pclish_oscmd():
ARGS = input("What OS command would you like to run")
os.system(ARGS)
def pclish_help():
print("""pclish: here are the commands available
help: shows this page
@ -106,7 +112,7 @@ def pclish_shtdwnsubsys():
# Shell Prompt Customization and step 2 of command interpritation
def main():
while True:
inp = input(user@hostname prefix)
inp = input(PROMPT)
if inp == "exit":
break
elif inp[:3] == "cd ":
@ -125,10 +131,11 @@ def main():
pclish_system()
elif inp == "echo":
pclish_echo()
elif inp == "oscmd":
pclish_oscmd()
else:
execute_command(inp)
# Main
if '__main__' == __name__:
main()