-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcli.py
executable file
·47 lines (37 loc) · 937 Bytes
/
cli.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
41
42
43
44
45
46
47
#!/usr/bin/python
import cmd
import string
import sys
import argparse
import getpass
import os
class wbo_shell(cmd.Cmd):
def emptyline(self):
pass
def help_show(self):
print "Possible arugments:"
print " interfaces"
print " power"
print " temperature"
print " transciever"
def do_show(self, line):
''' show some results
Possible arguments:
interfaces
power
temperature
transciever'''
commands = line.split()
if len(commands) < 2:
print "Insufficient arguments to show"
return
print commands
def do_exit(self, line):
return True
def do_EOF(self, line):
return True
myUser = getpass.getuser()
myHostName = os.uname()[1]
my_shell = wbo_shell()
my_shell.prompt = myUser + "@" + myHostName + "> "
my_shell.cmdloop()