1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

samba-tool: Improved --help functionality

Added a new --help msg
Return an error when no subcommand is specified

Signed-off-by: Andrew Tridgell <tridge@samba.org>
This commit is contained in:
Giampaolo Lauria
2011-07-18 15:45:39 -04:00
committed by Andrew Tridgell
parent a2e2c130b0
commit f03a059814

View File

@ -3,7 +3,7 @@
# Unix SMB/CIFS implementation. # Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2009 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2009
# Copyright (C) Theresa Halloran <theresahalloran@gmail.com> 2011 # Copyright (C) Theresa Halloran <theresahalloran@gmail.com> 2011
# Copyright Giampaolo Lauria 2011 <lauria2@yahoo.com> # Copyright (C) Giampaolo Lauria <lauria2@yahoo.com> 2011
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -158,7 +158,11 @@ class SuperCommand(Command):
print "Available subcommands:" print "Available subcommands:"
for cmd in self.subcommands: for cmd in self.subcommands:
print "\t%-20s - %s" % (cmd, self.subcommands[cmd].description) print "\t%-20s - %s" % (cmd, self.subcommands[cmd].description)
if subcommand in [None, 'help', '-h', '--help' ]: if subcommand in [None]:
self.show_command_error("You must specify a subcommand")
return -1
if subcommand in ['-h', '--help']:
print "For more help on a specific subcommand, please type: samba-tool %s <subcommand> (-h|--help)" % myname
return 0 return 0
self.show_command_error("No such subcommand '%s'" % (subcommand)) self.show_command_error("No such subcommand '%s'" % (subcommand))