summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/__init__.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index dafdd77c87..af317ab7e0 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -112,14 +112,14 @@ class SuperCommand(Command):
subcommands = {}
def _run(self, myname, subcommand=None, *args):
- if subcommand is None:
- print "Available subcommands:"
- for subcommand in self.subcommands:
- print "\t%s" % subcommand
+ if subcommand in self.subcommands:
+ return self.subcommands[subcommand]._run(subcommand, *args)
+ print "Available subcommands:"
+ for cmd in self.subcommands:
+ print "\t%-20s - %s" % (cmd, self.subcommands[cmd].description)
+ if subcommand in [None, 'help', '-h', '--help' ]:
return 0
- if not subcommand in self.subcommands:
- raise CommandError("No such subcommand '%s'" % subcommand)
- return self.subcommands[subcommand]._run(subcommand, *args)
+ raise CommandError("No such subcommand '%s'" % subcommand)
def usage(self, myname, subcommand=None, *args):
if subcommand is None or not subcommand in self.subcommands: