Improve interactive shell help
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Thu, 18 Oct 2012 12:35:11 +0000 (15:35 +0300)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Thu, 18 Oct 2012 12:35:11 +0000 (15:35 +0300)
kamaki/cli/command_shell.py

index 032d3c4..94c2c4c 100644 (file)
@@ -53,6 +53,7 @@ class Shell(Cmd):
        _suffix = ']:'
        cmd_tree = None
        _history = None
+       undoc_header='interactive shell commands:'
 
        def greet(self, version):
                print('kamaki v%s - Interactive Shell\n\t(exit or ^D to exit)\n'%version)
@@ -66,8 +67,6 @@ class Shell(Cmd):
        def do_shell(self, line):
                output = popen(line).read()
                print(output)
-       def help_shell(self):
-               print('Execute OS shell commands')
 
        @property 
        def path(self):
@@ -172,6 +171,11 @@ class Shell(Cmd):
                        return subcmd.get_subnames()
                self._register_method(complete_method, 'complete_%s'%cmd.name)
 
+       @property 
+       def doc_header(self):
+               hdr = self.prompt.partition(self._prefix)[2].partition(self._suffix)[0].strip()
+               return '%s commands:'%hdr
+
        def run(self, path=''):
                self._history = History(_arguments['config'].get('history', 'file'))
                if len(path):