summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-07-21 12:15:33 +1000
committerAndrew Tridgell <tridge@samba.org>2011-07-28 15:20:52 +1000
commitd4c1149e3ec11a59cb49cd9be71079e503eb9e19 (patch)
tree5132473266ab42bf4d0076d9c08ad22c538ca4dc /source4/scripting
parent02667cbe2627898fb2937f649015373a1d450de3 (diff)
downloadsamba-d4c1149e3ec11a59cb49cd9be71079e503eb9e19.tar.gz
samba-d4c1149e3ec11a59cb49cd9be71079e503eb9e19.tar.bz2
samba-d4c1149e3ec11a59cb49cd9be71079e503eb9e19.zip
samba-tool: Display Usage line and list commands alphabetically
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index 3e8d274b7e..316a819053 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -157,9 +157,12 @@ class SuperCommand(Command):
def _run(self, myname, subcommand=None, *args):
if subcommand in self.subcommands:
return self.subcommands[subcommand]._run(subcommand, *args)
+ print "Usage: samba-tool %s <subcommand> [options]" % myname
print "Available subcommands:"
- for cmd in self.subcommands:
- print "\t%-20s - %s" % (cmd, self.subcommands[cmd].description)
+ subcmds = self.subcommands.keys()
+ subcmds.sort()
+ for cmd in subcmds:
+ print " %-20s - %s" % (cmd, self.subcommands[cmd].description)
if subcommand in [None]:
self.show_command_error("You must specify a subcommand")
return -1
@@ -176,7 +179,7 @@ class SuperCommand(Command):
def usage(self, myname, subcommand=None, *args):
if subcommand is None or not subcommand in self.subcommands:
- print "Usage: %s (%s) [options]" % (myname,
+ print "Usage: samba-tool %s (%s) [options]" % (myname,
" | ".join(self.subcommands.keys()))
else:
return self.subcommands[subcommand].usage(*args)