From c1a798255705a457e78b7b02bd56c641b0fe825b Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Mon, 28 Oct 2013 03:07:45 +0100 Subject: [PATCH] added some command stubs and refactored help output --- linspector/frontends/lish.py | 73 +++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/linspector/frontends/lish.py b/linspector/frontends/lish.py index e75e834..55b1a73 100644 --- a/linspector/frontends/lish.py +++ b/linspector/frontends/lish.py @@ -31,7 +31,7 @@ from shlex import split as shsplit from linspector.frontends.frontend import Frontend -__version__ = "0.2" +__version__ = "0.2.1-alpha" PURPLE = "\033[95m" BLUE = "\033[94m" @@ -120,10 +120,10 @@ class LishCommander(Exit): exec text def help_python(self): - print "Executes Python code using 'exec'." + print("Executes Python code using 'exec'.") def print_color(self, color, text): - print color + str(text) + END + print(color + str(text) + END) def print_dict(self, dict): for key, val in dict.items(): @@ -131,7 +131,7 @@ class LishCommander(Exit): if len(str(key)) < 7: tab += "\t" - print GREEN + str(key) + END + tab + YELLOW + str(val) + END + print(GREEN + str(key) + END + tab + YELLOW + str(val) + END) def print_jobs_infos(self, job): self.print_dict(self.interface.get_job_info_dict(job)) @@ -164,11 +164,11 @@ class LishCommander(Exit): return self.get_completion(["enable", "disable"], text) def help_job(self): - print '''Usage: - Prints extended information about this job - enable: Enables a job - disable: Disables a job - ''' + print('''Usage: + : Prints extended information about this job + enable: Enables a job + disable: Disables a job + ''') def do_jobs(self, text): if text == "list": @@ -189,16 +189,42 @@ class LishCommander(Exit): self.help_jobs() def help_jobs(self): - print '''Usage: - count Show count of all jobs - list Lists all jobs - ''' + print('''Usage: + count: Show count of all jobs + list: Lists all jobs''') + + def do_host(self, text): + pass + + def help_host(self): + print('''Usage: + : Prints extended information about + enable: Enables all jobs for + disable: Disables all jobs for ''') + + def do_hostgroup(self, text): + pass + + def help_hostgroup(self): + print('''Usage: + : Prints extended information about + enable: Enables all jobs for + disable: Disables all jobs for ''') + + def do_hostgrouphost(self, text): + pass + + def help_hostgrouphost(self): + print('''Usage: + Prints extended information about in + enable: Enables all jobs for in + disable: Disables all jobs for in ''') def do_shell(self, text): os.system(text) def help_shell(self): - print("execute any shell command. Can also be achieved by a '!' prefix") + print("Execute any shell command. Can also be achieved by a '!' prefix") def complete_shell(self, text, line, begidx, endidx): try: @@ -212,10 +238,16 @@ class LishCommander(Exit): pass def do_log(self, text): - print '''executed %s''' % text + print('''executed %s''' % text) def help_log(self): - print '''Manage logging''' + print('''Manage logging''') + + def do_status(self, text): + print('''executed %s''' % text) + + def help_status(self): + print('''Show status information about the Linspector instance''') def do_about(self, text): self.print_color(GREEN, "Linspector Monitoring\n") @@ -227,13 +259,13 @@ class LishCommander(Exit): self.print_color(PURPLE, "License: GNU Affero General Public License Version 3.0") def help_about(self): - print '''Show information about Linspector''' + print('''Show information about Linspector''') def do_license(self, text): os.system("less " + os.path.dirname(os.path.abspath(__file__)) + "/../../LICENSE") def help_license(self): - print '''Show license information''' + print('''Show license information''') def do_man(self, text): try: @@ -245,6 +277,5 @@ class LishCommander(Exit): self.help_man() def help_man(self): - print '''Usage: - man Show manual page - ''' \ No newline at end of file + print('''Usage: + : Show manual page ''') \ No newline at end of file