many syntax fixes in lish help commands
This commit is contained in:
parent
3aa231c429
commit
c3c7dc34fc
1 changed files with 14 additions and 13 deletions
|
|
@ -190,7 +190,7 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
return self.get_completion(["list", "select"], text)
|
return self.get_completion(["list", "select"], text)
|
||||||
|
|
||||||
def help_hostgroup(self):
|
def help_hostgroup(self):
|
||||||
print '''usage:
|
print '''Usage:
|
||||||
hostgroup list
|
hostgroup list
|
||||||
prints a list of all hostgroups
|
prints a list of all hostgroups
|
||||||
hostgroup select HOSTGROUPNAME
|
hostgroup select HOSTGROUPNAME
|
||||||
|
|
@ -201,7 +201,7 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
exec text
|
exec text
|
||||||
|
|
||||||
def help_python(self):
|
def help_python(self):
|
||||||
print "executes python using 'exec'."
|
print "Executes Python code using 'exec'."
|
||||||
|
|
||||||
def print_color(self, color, text):
|
def print_color(self, color, text):
|
||||||
print color + str(text) + END
|
print color + str(text) + END
|
||||||
|
|
@ -223,7 +223,7 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
job = self.interface.find_job_by_hex_string(job_hex)
|
job = self.interface.find_job_by_hex_string(job_hex)
|
||||||
|
|
||||||
if job is None:
|
if job is None:
|
||||||
print RED + "first parameter must be a job hex id! get a List of all ids by typing 'jobs list'\n" + END
|
self.print_color(RED, "First parameter must be a job ID. Get a List of all IDs by typing 'jobs list'")
|
||||||
self.help_job()
|
self.help_job()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -235,7 +235,7 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
if cmd in ["enable", "disable"]:
|
if cmd in ["enable", "disable"]:
|
||||||
job.set_enabled("n" in cmd)
|
job.set_enabled("n" in cmd)
|
||||||
else:
|
else:
|
||||||
print RED + "invalid or missing parameter\n" + END
|
self.print_color(RED, "Invalid or missing parameter")
|
||||||
self.help_job()
|
self.help_job()
|
||||||
|
|
||||||
def complete_job(self, text, line, begidx, endidx):
|
def complete_job(self, text, line, begidx, endidx):
|
||||||
|
|
@ -245,10 +245,10 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
return self.get_completion(["enable", "disable"], text)
|
return self.get_completion(["enable", "disable"], text)
|
||||||
|
|
||||||
def help_job(self):
|
def help_job(self):
|
||||||
print '''usage:
|
print '''Usage:
|
||||||
<ID> prints extended information about this job
|
<ID> Prints extended information about this job
|
||||||
<ID> enable: enables a job
|
<ID> enable: Enables a job
|
||||||
<ID> disable: disables a job
|
<ID> disable: Disables a job
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def do_jobs(self, text):
|
def do_jobs(self, text):
|
||||||
|
|
@ -256,12 +256,12 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
for job in self.interface.jobs:
|
for job in self.interface.jobs:
|
||||||
print job.pretty_string()
|
print job.pretty_string()
|
||||||
else:
|
else:
|
||||||
print RED + "invalid or missing parameter\n" + END
|
self.print_color(RED, "Invalid or missing parameter")
|
||||||
self.help_jobs()
|
self.help_jobs()
|
||||||
|
|
||||||
def help_jobs(self):
|
def help_jobs(self):
|
||||||
print '''usage:
|
print '''Usage:
|
||||||
list lists all jobs
|
list Lists all jobs
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def do_about(self, text):
|
def do_about(self, text):
|
||||||
|
|
@ -285,12 +285,13 @@ class LishCommander(Exit, ShellCommander, LogCommander):
|
||||||
def do_man(self, text):
|
def do_man(self, text):
|
||||||
try:
|
try:
|
||||||
with open(os.path.dirname(os.path.abspath(__file__)) + "/../../man/" + text + ".md"):
|
with open(os.path.dirname(os.path.abspath(__file__)) + "/../../man/" + text + ".md"):
|
||||||
|
#TODO: maybe convert markdown to plain text before displaying it and write own pager in pure Python
|
||||||
os.system("less " + os.path.dirname(os.path.abspath(__file__)) + "/../../man/" + text + ".md")
|
os.system("less " + os.path.dirname(os.path.abspath(__file__)) + "/../../man/" + text + ".md")
|
||||||
except IOError:
|
except IOError:
|
||||||
self.print_color(RED, "Manual page \"" + text + "\" not found.")
|
self.print_color(RED, "Manual page \"" + text + "\" not found.")
|
||||||
self.help_man()
|
self.help_man()
|
||||||
|
|
||||||
def help_man(self):
|
def help_man(self):
|
||||||
print '''usage:
|
print '''Usage:
|
||||||
man <PAGE> Show manual page
|
man <PAGE> Show manual page <PAGE>
|
||||||
'''
|
'''
|
||||||
Loading…
Add table
Add a link
Reference in a new issue