-
Notifications
You must be signed in to change notification settings - Fork 0
/
kCLI.py
30 lines (26 loc) · 835 Bytes
/
kCLI.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
class CliConstructor(object):
def __init__(self):
self.cli = ''.lower()
def initial(self, prompt):
import sys
self.prompt = prompt
while self.cli != 'exit':
self.cli = input(self.prompt).lower()
try:
getattr(self, self.cli)()
except:
if self.cli != 'exit':
print('Command not found')
sys.exit('Graceful exit')
def add(self):
pass
def help(self):
print('''
kCLI helper:
help - print this message
create - create config
add - add service to config
del - del service from config
exit - exit from kCLI
''')
local_cli = CliConstructor().initial('kCLI:>')