diff options
author | Giampaolo Lauria <lauria2@yahoo.com> | 2011-08-01 17:47:31 -0400 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-09-09 15:24:01 +1000 |
commit | ef01932fdbf395c5a27f1935b585c6457a427574 (patch) | |
tree | b63643146389f56374b7afe2361bafba3b66a55b | |
parent | fb5e27e4c87dddca4c1609bf8a83f2c213991782 (diff) | |
download | samba-ef01932fdbf395c5a27f1935b585c6457a427574.tar.gz samba-ef01932fdbf395c5a27f1935b585c6457a427574.tar.bz2 samba-ef01932fdbf395c5a27f1935b585c6457a427574.zip |
samba-tool: Formatted subcommand list output
Formatted output of subcommand list to be a function of the
max number of chars in the longest string
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/scripting/python/samba/netcmd/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py index a4a3397d80..3b7b982459 100644 --- a/source4/scripting/python/samba/netcmd/__init__.py +++ b/source4/scripting/python/samba/netcmd/__init__.py @@ -162,8 +162,9 @@ class SuperCommand(Command): print "Available subcommands:" subcmds = self.subcommands.keys() subcmds.sort() + max_length = len(max(subcmds, key=len)) for cmd in subcmds: - print " %-20s - %s" % (cmd, self.subcommands[cmd].description) + print " %*s - %s" % (-max_length, cmd, self.subcommands[cmd].description) if subcommand in [None]: raise CommandError("You must specify a subcommand") if subcommand in ['help', '-h', '--help']: |