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

samba-tool: epilog option to OptionParser available in python >= 2.6

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Amitay Isaacs
2011-09-09 13:27:13 +10:00
committed by Andrew Bartlett
parent 4d0ead86e1
commit 46754e9665
5 changed files with 5 additions and 8 deletions

View File

@ -49,8 +49,6 @@ class Command(object):
"credopts": options.CredentialsOptions, "credopts": options.CredentialsOptions,
"versionopts": options.VersionOptions, "versionopts": options.VersionOptions,
} }
# This epilog will print at the end when the user invokes the command w/ -h or --help
epilog = ""
outf = sys.stdout outf = sys.stdout
def usage(self, *args): def usage(self, *args):
@ -92,7 +90,7 @@ class Command(object):
sys.exit(1) sys.exit(1)
def _create_parser(self): def _create_parser(self):
parser = optparse.OptionParser(usage=self.synopsis, epilog=self.epilog, parser = optparse.OptionParser(usage=self.synopsis,
description=self.long_description) description=self.long_description)
parser.add_options(self.takes_options) parser.add_options(self.takes_options)
optiongroups = {} optiongroups = {}
@ -165,7 +163,6 @@ class SuperCommand(Command):
max_length = max(map(lambda c: len(c), subcmds)) max_length = max(map(lambda c: len(c), subcmds))
for cmd in subcmds: for cmd in subcmds:
print " %*s - %s" % (-max_length, cmd, self.subcommands[cmd].description) print " %*s - %s" % (-max_length, cmd, self.subcommands[cmd].description)
print " * server connection needed"
if subcommand in [None]: if subcommand in [None]:
raise CommandError("You must specify a subcommand") raise CommandError("You must specify a subcommand")
if subcommand in ['help', '-h', '--help']: if subcommand in ['help', '-h', '--help']:

View File

@ -254,7 +254,7 @@ all=all of the above"""),
class cmd_fsmo(SuperCommand): class cmd_fsmo(SuperCommand):
"""Flexible Single Master Operations (FSMO) roles management *""" """Flexible Single Master Operations (FSMO) roles management"""
subcommands = {} subcommands = {}
subcommands["seize"] = cmd_fsmo_seize() subcommands["seize"] = cmd_fsmo_seize()

View File

@ -28,7 +28,7 @@ from samba.netcmd import (
) )
class cmd_time(Command): class cmd_time(Command):
"""Retrieve the time on a remote server *""" """Retrieve the time on a remote server"""
synopsis = "%prog time [server-name] [options]" synopsis = "%prog time [server-name] [options]"
takes_args = ["server_name?"] takes_args = ["server_name?"]

View File

@ -288,7 +288,7 @@ class cmd_user_setpassword(Command):
class cmd_user(SuperCommand): class cmd_user(SuperCommand):
"""User management *""" """User management"""
subcommands = {} subcommands = {}
subcommands["add"] = cmd_user_add() subcommands["add"] = cmd_user_add()

View File

@ -31,7 +31,7 @@ from samba.netcmd import (
) )
class cmd_vampire(Command): class cmd_vampire(Command):
"""Join and synchronise a remote AD domain to the local server [server connection needed]""" """Join and synchronise a remote AD domain to the local server"""
synopsis = "%prog vampire [options] <domain>" synopsis = "%prog vampire [options] <domain>"
takes_options = [ takes_options = [