This will make a difference to the string printed in the cases that
call self.usage(), resulting in more specified usage for the
sub-command. It would also matter if the samba-tool sub-command had a
different .show_command_error() or .errf, but I don't think that
happens.
Note: usually command._run() will have caught and shown the exception,
returning -1.
We also rename away 'cmd' so we don't again imagine it is the command
we are running.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
signal.signal(signal.SIGINT, signal.SIG_DFL)
from samba.netcmd.main import cmd_sambatool
-cmd = cmd_sambatool()
+samba_tool = cmd_sambatool()
try:
- command, args = cmd._resolve("samba-tool", *sys.argv[1:])
+ command, args = samba_tool._resolve("samba-tool", *sys.argv[1:])
retval = command._run(*args)
except SystemExit as e:
retval = e.code
except Exception as e:
- cmd.show_command_error(e)
+ command.show_command_error(e)
retval = 1
sys.exit(retval)