ui:command_line: use command names in command-list help message.
authorW. Trevor King <wking@tremily.us>
Mon, 3 Sep 2012 18:26:36 +0000 (14:26 -0400)
committerW. Trevor King <wking@tremily.us>
Mon, 3 Sep 2012 18:32:59 +0000 (14:32 -0400)
The old implementation used module names.  For example:
  command name: import-xml
  module name:  import_xml

libbe/ui/command_line.py

index cd28887e3804e608fccec796e40b30a9a59763cd..b96d278e5099bcc8eaf77c02b0d0600e15da97bd 100644 (file)
@@ -258,14 +258,14 @@ class BE (libbe.command.Command):
             Class = libbe.command.get_command_class(command_name=name)
             assert hasattr(Class, '__doc__') and Class.__doc__ != None, \
                 'Command class %s missing docstring' % Class
-            cmdlist.append((name, Class.__doc__.splitlines()[0]))
+            cmdlist.append((Class.name, Class.__doc__.splitlines()[0]))
         cmdlist.sort()
         longest_cmd_len = max([len(name) for name,desc in cmdlist])
         ret = ['Bugs Everywhere - Distributed bug tracking',
                '', 'Supported commands']
         for name, desc in cmdlist:
             numExtraSpaces = longest_cmd_len-len(name)
-            ret.append('be %s%*s    %s' % (name, numExtraSpaces, '', desc))
+            ret.append('be {}{}    {}'.format(name, ' '*numExtraSpaces, desc))
         ret.extend(['', 'Run', '  be help [command]', 'for more information.'])
         return '\n'.join(ret)