summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorGiampaolo Lauria <lauria2@yahoo.com>2011-07-29 17:04:45 -0400
committerAndrew Bartlett <abartlet@samba.org>2011-09-09 15:24:01 +1000
commite309c782baa5535a60621492d6ffa77dff37b899 (patch)
tree277247e45d5337e432f35ac228ce54dd494c2a1b /source4/scripting
parentf5e173284a959197ea3ee347fc9625aadb9591dc (diff)
downloadsamba-e309c782baa5535a60621492d6ffa77dff37b899.tar.gz
samba-e309c782baa5535a60621492d6ffa77dff37b899.tar.bz2
samba-e309c782baa5535a60621492d6ffa77dff37b899.zip
samba-tool: Add long_description and epilog to Command class
long_description and epilog should now be defined for each command. Their string value will be printed whenever the user invokes the command w/ the -h or --help long_desciption will be printed after the usage statement. epilog will be printed after the options are defined Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index 360134644b..6d6d59ac18 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -40,6 +40,8 @@ class Command(object):
# synopsis must be defined in all subclasses in order to provide the command usage
synopsis = ""
+ # long_description is a string describing the command in details
+ long_description = ""
takes_args = []
takes_options = []
takes_optiongroups = {
@@ -47,6 +49,8 @@ class Command(object):
"credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions,
}
+ # This epilog will print at the end when the user invokes the command w/ -h or --help
+ epilog = ""
outf = sys.stdout
def usage(self, *args):
@@ -88,7 +92,8 @@ class Command(object):
sys.exit(1)
def _create_parser(self):
- parser = optparse.OptionParser(self.synopsis)
+ parser = optparse.OptionParser(usage=self.synopsis, epilog=self.epilog,
+ description=self.long_description)
parser.add_options(self.takes_options)
optiongroups = {}
for name, optiongroup in self.takes_optiongroups.iteritems():