Revision 9a033156 lib/cli.py

b/lib/cli.py
251 251
           "\n%(bin)s <command> --help to see details, or"
252 252
           " man %(bin)s\n" % {"bin": binary})
253 253
    # compute the max line length for cmd + usage
254
    mlen = max([len(" %s" % cmd) for cmd in commands])
254
    mlen = max([len(" %s %s" % (cmd, commands[cmd][3])) for cmd in commands])
255 255
    mlen = min(60, mlen) # should not get here...
256 256
    # and format a nice command list
257 257
    print "Commands:"
258 258
    for cmd in sortedcmds:
259
      cmdstr = " %s" % (cmd,)
260
      help_text = commands[cmd][3]
259
      cmdstr = " %s %s" % (cmd, commands[cmd][3])
260
      help_text = commands[cmd][4]
261 261
      help_lines = textwrap.wrap(help_text, 79-3-mlen)
262
      print "%-*s - %s" % (mlen, cmdstr, help_lines.pop(0))
262
      print "%-*s - %s" % (mlen, cmdstr,
263
                                          help_lines.pop(0))
263 264
      for line in help_lines:
264 265
        print "%-*s   %s" % (mlen, "", line)
265 266
    print

Also available in: Unified diff