diff options
author | Giampaolo Lauria <lauria2@yahoo.com> | 2011-07-28 21:44:06 -0400 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-09-09 15:24:01 +1000 |
commit | f5e173284a959197ea3ee347fc9625aadb9591dc (patch) | |
tree | e692a1cc91f98676dd831c0565b1b52668f59c8c /source4/scripting/python | |
parent | 02650acac397afe509b6b3bce6df975920d386b8 (diff) | |
download | samba-f5e173284a959197ea3ee347fc9625aadb9591dc.tar.gz samba-f5e173284a959197ea3ee347fc9625aadb9591dc.tar.bz2 samba-f5e173284a959197ea3ee347fc9625aadb9591dc.zip |
samba-tool: Redefined samba-tool as a SuperCommand
Removed MainCommand class as samba-tool is a SuperCommand
Redefined samba-tool as a SuperCommand
Fixed error handling in SuperCommand _run
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/netcmd/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py index 12e6a99b4d..360134644b 100644 --- a/source4/scripting/python/samba/netcmd/__init__.py +++ b/source4/scripting/python/samba/netcmd/__init__.py @@ -148,7 +148,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 + + if (myname == "samba-tool"): + usage = "samba-tool <subcommand>" + else: + usage = "samba-tool %s <subcommand>" % myname + print "Usage: %s [options]" %usage print "Available subcommands:" subcmds = self.subcommands.keys() subcmds.sort() @@ -157,7 +162,7 @@ class SuperCommand(Command): if subcommand in [None]: raise CommandError("You must specify a subcommand") if subcommand in ['help', '-h', '--help']: - print "For more help on a specific subcommand, please type: samba-tool %s <subcommand> (-h|--help)" % myname + print "For more help on a specific subcommand, please type: %s (-h|--help)" % usage return 0 raise CommandError("No such subcommand '%s'" % subcommand) |