Update shell.py
This commit is contained in:
parent
745b35879b
commit
7e993235cb
32
shell.py
32
shell.py
|
@ -8,7 +8,7 @@ RAM = psutil.virtual_memory()
|
||||||
CPU = platform.processor()
|
CPU = platform.processor()
|
||||||
OS = os_name = platform.system()
|
OS = os_name = platform.system()
|
||||||
|
|
||||||
VER = "PCLISH v0.0.5a"
|
VER = "PCLISH v0.0.5a-patch2a"
|
||||||
|
|
||||||
PROMPT = "shell@localhost$ "
|
PROMPT = "shell@localhost$ "
|
||||||
|
|
||||||
|
@ -54,14 +54,13 @@ def pclish_cd(path):
|
||||||
except Exception:
|
except Exception:
|
||||||
print("cd: no such file or directory: {}".format(path))
|
print("cd: no such file or directory: {}".format(path))
|
||||||
|
|
||||||
def pclish_echo(txt):
|
def pclish_echo():
|
||||||
try:
|
TXT = input("ARGS: ")
|
||||||
print((txt))
|
print(TXT)
|
||||||
except Exception:
|
|
||||||
print("You need to provide arguments for this command. {}".format(path))
|
|
||||||
|
|
||||||
def pclish_oscmd(ARGS):
|
def pclish_oscmd():
|
||||||
os.system(ARGS)
|
CMD = input("ARGS: ")
|
||||||
|
os.system(CMD)
|
||||||
|
|
||||||
def pclish_help():
|
def pclish_help():
|
||||||
print("""pclish: here are the commands available
|
print("""pclish: here are the commands available
|
||||||
|
@ -80,7 +79,8 @@ def pclish_ls():
|
||||||
def pclish_ver():
|
def pclish_ver():
|
||||||
print(VER)
|
print(VER)
|
||||||
|
|
||||||
def pclish_mkdir(DIR):
|
def pclish_mkdir():
|
||||||
|
DIR = input("ARGS: ")
|
||||||
os.mkdir(DIR)
|
os.mkdir(DIR)
|
||||||
|
|
||||||
def pclish_system():
|
def pclish_system():
|
||||||
|
@ -104,24 +104,24 @@ def main():
|
||||||
inp = input(PROMPT)
|
inp = input(PROMPT)
|
||||||
if inp == "exit":
|
if inp == "exit":
|
||||||
break
|
break
|
||||||
elif inp[:3] == "cd ":
|
elif inp[] == "cd ":
|
||||||
pclish_cd(inp[3:])
|
pclish_cd(inp[3:])
|
||||||
elif inp == "help":
|
elif inp == "help":
|
||||||
pclish_help()
|
pclish_help()
|
||||||
elif inp == "ver":
|
elif inp == "ver":
|
||||||
pclish_ver()
|
pclish_ver()
|
||||||
elif inp == "ls ":
|
elif inp == "ls":
|
||||||
pclish_ls(inp[3:])
|
pclish_ls()
|
||||||
elif inp[:3] == "mkdir ":
|
elif inp[] == "mkdir":
|
||||||
pclish_mkdir(inp[3:])
|
pclish_mkdir()
|
||||||
elif inp == "shtdwnsubsys":
|
elif inp == "shtdwnsubsys":
|
||||||
pclish_shtdwnsubsys()
|
pclish_shtdwnsubsys()
|
||||||
elif inp == "system":
|
elif inp == "system":
|
||||||
pclish_system()
|
pclish_system()
|
||||||
elif inp[:3] == "echo ":
|
elif inp[:3] == "echo ":
|
||||||
pclish_echo(inp[3:])
|
pclish_echo()
|
||||||
elif inp[:3] == "oscmd ":
|
elif inp[:3] == "oscmd ":
|
||||||
pclish_oscmd(inp[3:])
|
pclish_oscmd()
|
||||||
else:
|
else:
|
||||||
execute_command(inp)
|
execute_command(inp)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue