From ef01932fdbf395c5a27f1935b585c6457a427574 Mon Sep 17 00:00:00 2001 From: Giampaolo Lauria Date: Mon, 1 Aug 2011 17:47:31 -0400 Subject: 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 Signed-off-by: Andrew Bartlett --- source4/scripting/python/samba/netcmd/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') 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']: -- cgit