From: Douglas Bagnall Date: Fri, 11 Aug 2017 04:39:33 +0000 (+1200) Subject: samba-tool: treat 'samba-tool help foo' as 'samba-tool foo --help' X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=316594f211340cc2d11a98895f624b50f2e51f7c samba-tool: treat 'samba-tool help foo' as 'samba-tool foo --help' Vaguely keeping up with the modern style. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py index ad8143de856f..05ecc432ea6b 100644 --- a/python/samba/netcmd/__init__.py +++ b/python/samba/netcmd/__init__.py @@ -202,6 +202,19 @@ class SuperCommand(Command): return self.subcommands[subcommand]._run( "%s %s" % (myname, subcommand), *args) + if subcommand == 'help': + # pass the request down + if len(args) > 0: + sub = self.subcommands.get(args[0]) + if isinstance(sub, SuperCommand): + return sub._run("%s %s" % (myname, args[0]), 'help', + *args[1:]) + elif sub is not None: + return sub._run("%s %s" % (myname, args[0]), '--help', + *args[1:]) + + subcommand = '--help' + epilog = "\nAvailable subcommands:\n" subcmds = self.subcommands.keys() subcmds.sort()