begin of abstracting linpector commands
This commit is contained in:
parent
9fb7e956b0
commit
ddd7c5be09
1 changed files with 18 additions and 1 deletions
|
|
@ -133,6 +133,23 @@ class HostgroupCommander(Exit, object):
|
||||||
print("gives you control over a member of the hostgroup")
|
print("gives you control over a member of the hostgroup")
|
||||||
|
|
||||||
|
|
||||||
|
class Command(object):
|
||||||
|
def __init__(self, name, command, helpText, children=None):
|
||||||
|
self.name = name
|
||||||
|
self.command = command
|
||||||
|
self.helpText = helpText
|
||||||
|
self.children = children
|
||||||
|
self.completion = []
|
||||||
|
if isinstance(children, list):
|
||||||
|
for child in children:
|
||||||
|
self.completion.append((child.get_name()))
|
||||||
|
|
||||||
|
|
||||||
|
class CommandTree(object):
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
|
||||||
class LishCommander(Exit, ShellCommander, LogCommander):
|
class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
def __init__(self, linspectorInterface):
|
def __init__(self, linspectorInterface):
|
||||||
|
|
||||||
|
|
@ -150,7 +167,7 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
for l in self.interface.get_enabled_layouts():
|
for l in self.interface.get_enabled_layouts():
|
||||||
print l.get_name()
|
print l.get_name()
|
||||||
space = 4 * " "
|
space = 4 * " "
|
||||||
for hg in l.get_hostgroups():
|
for hg in l.get_hostgroutrolldrosselps():
|
||||||
print space + hg.get_name()
|
print space + hg.get_name()
|
||||||
print 3 * "\n"
|
print 3 * "\n"
|
||||||
elif args[0] == "select":
|
elif args[0] == "select":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue