-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (28 loc) · 809 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from cmd import Cmd
import os
class MyPrompt(Cmd):
# prompt = "|" + os.getcwd() + " >> "
intro = "Welcome to LoboSh! Type ? to list all commands"
def do_exit(self, inp):
'''Exit the shell prompt'''
print("Process ended")
return True
def do_echo(self, inp):
'''Repeate anything that the user inputs as an argument'''
print("{}".format(inp))
def do_yes(self, inp):
'''Repeate anything that the user inputs as an argument an infinite number of times'''
while True:
print("{}".format(inp))
def do_clear(self, inp):
os.system('clear')
def do_cd(self, inp):
os.chdir(inp)
os.getcwd()
def do_ls(self, inp):
for i in os.listdir():
print(i)
do_EOF = do_exit
prompt = os.getcwd() + " >> "
MyPrompt().cmdloop()
print("successfully")