- output += " $(grn)"
- output += item + "$(nrm) - " + description + "$(eol)"
- output += ('$(eol)Enter "help COMMAND" for help on a command '
- 'named "COMMAND".')
+ abbrev = command_name
+
+ # supply a useful default if the short description is missing
+ description = command.get(
+ "description", "(no short description provided)")
+
+ # administrative command names are in red, others in green
+ if command.is_restricted():
+ color = "red"
+ else:
+ color = "grn"
+
+ # format the entry for this command
+ output = "%s $(%s)%s$(nrm) - %s$(eol)" % (
+ output, color, abbrev, description)
+
+ # add a footer with instructions on getting additional information
+ output = ('%s $(eol)Enter "help COMMAND" for help on a command named '
+ '"COMMAND".' % output)