-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.py
40 lines (31 loc) · 1.27 KB
/
command.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
40
from management import *
from logs_file import *
from calculator import *
from cm_list import *
q_list = ['q', 'quit', 'exit', 'stop', 'logout']
class Command():
def __init__(self, username, *args, **kwargs):
self.username = username
self.current_dir = ''
self.real_current_dir = 'root\\' + self.username
def username_title(self):
return '\n{}\{} >> '.format(self.username, self.current_dir)
def read_input_command(self):
while True:
temp_cm = input(self.username_title())
temp_cm = temp_cm.split(' ')
if temp_cm[0].lower() in q_list:
add_record(self.username, 'logout', temp_cm[0], 'Success')
print('\n\n\n')
return temp_cm[0]
try:
print(all_cm[temp_cm[0].lower()]['func']
(self, temp_cm[1:]))
except KeyError:
print(colored('Enter a Valid Command Key!\n', 'yellow'))
add_record(self.username, 'Not Valid', temp_cm[0],
'Fail')
except TypeError:
print(colored('Enter a Valid Command Key!\n', 'yellow'))
add_record(self.username, 'Not Valid', temp_cm[0],
'Fail')