Fix top-level from top-level call bug
authorStavros Sachtouris <saxtouri@admin.grnet.gr>
Thu, 15 Nov 2012 16:09:49 +0000 (18:09 +0200)
committerStavros Sachtouris <saxtouri@admin.grnet.gr>
Thu, 15 Nov 2012 16:09:49 +0000 (18:09 +0200)
Idea: in pre: add top level commands as /<command>
slightly different registration

kamaki/cli/command_shell.py

index 3755d92..57d8b11 100644 (file)
@@ -72,8 +72,8 @@ class Shell(Cmd):
 
     def precmd(self, line):
         if line.startswith('/'):
-            if self.prompt != self.cmd_tree.name:
-                cur_cmd_path = self.prompt.replace(' ', '_')[1:-2]
+            cur_cmd_path = self.prompt.replace(' ', '_')[1:-2]
+            if cur_cmd_path != self.cmd_tree.name:
                 cur_cmd = self.cmd_tree.get_command(cur_cmd_path)
 
                 self._context_stack.append(self._backup())