diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-10-13 23:27:22 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-10-14 00:22:57 +0200 |
commit | 9213f398adf9aa29d0c59a4caee440dba70e4a7d (patch) | |
tree | 9684fdcfdad365a40aa69e7a16922cd96bc68059 | |
parent | b5d59458012d1b9f91bd08f4c36fc108f23af19a (diff) | |
download | samba-9213f398adf9aa29d0c59a4caee440dba70e4a7d.tar.gz samba-9213f398adf9aa29d0c59a4caee440dba70e4a7d.tar.bz2 samba-9213f398adf9aa29d0c59a4caee440dba70e4a7d.zip |
samba-tool: Don't require full prog line to be in synopsis.
17 files changed, 80 insertions, 98 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py index ad6e688da8..4d40b69d88 100644 --- a/source4/scripting/python/samba/netcmd/__init__.py +++ b/source4/scripting/python/samba/netcmd/__init__.py @@ -66,8 +66,8 @@ class Command(object): outf = sys.stdout errf = sys.stderr - def usage(self, *args): - parser, _ = self._create_parser() + def usage(self, prog, *args): + parser, _ = self._create_parser(prog) parser.print_usage() def show_command_error(self, e): @@ -103,9 +103,11 @@ class Command(object): if force_traceback or samba.get_debug_level() >= 3: traceback.print_tb(etraceback) - def _create_parser(self): - parser = optparse.OptionParser(usage=self.synopsis, - description=self.full_description) + def _create_parser(self, prog): + parser = optparse.OptionParser( + usage=self.synopsis, + description=self.full_description, + prog=prog) parser.add_options(self.takes_options) optiongroups = {} for name, optiongroup in self.takes_optiongroups.iteritems(): @@ -117,7 +119,7 @@ class Command(object): self.outf.write(text+"\n") def _run(self, *argv): - parser, optiongroups = self._create_parser() + parser, optiongroups = self._create_parser(argv[0]) opts, args = parser.parse_args(list(argv)) # Filter out options from option groups args = args[1:] @@ -170,13 +172,10 @@ class SuperCommand(Command): def _run(self, myname, subcommand=None, *args): if subcommand in self.subcommands: - return self.subcommands[subcommand]._run(subcommand, *args) + return self.subcommands[subcommand]._run( + "%s %s" % (myname, subcommand), *args) - if myname == "samba-tool": - usage = "samba-tool <subcommand>" - else: - usage = "samba-tool %s <subcommand>" % myname - self.outf.write("Usage: %s [options]\n" % usage) + self.usage(myname) self.outf.write("Available subcommands:\n") subcmds = self.subcommands.keys() subcmds.sort() @@ -187,14 +186,15 @@ class SuperCommand(Command): if subcommand in [None]: raise CommandError("You must specify a subcommand") if subcommand in ['help', '-h', '--help']: - self.outf.write("For more help on a specific subcommand, please type: %s (-h|--help)\n" % usage) + self.outf.write("For more help on a specific subcommand, please type: %s (-h|--help)\n" % myname) return 0 raise CommandError("No such subcommand '%s'" % subcommand) class CommandError(Exception): - '''an exception class for samba-tool cmd errors''' + """An exception class for samba-tool Command errors.""" + def __init__(self, message, inner_exception=None): self.message = message self.inner_exception = inner_exception diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py index 44f3dedf34..1d4a5b4f33 100644 --- a/source4/scripting/python/samba/netcmd/dbcheck.py +++ b/source4/scripting/python/samba/netcmd/dbcheck.py @@ -33,7 +33,7 @@ from samba.dbchecker import dbcheck class cmd_dbcheck(Command): """check local AD database for errors""" - synopsis = "%prog dbcheck [<DN>] [options]" + synopsis = "%prog [<DN>] [options]" takes_args = ["DN?"] diff --git a/source4/scripting/python/samba/netcmd/delegation.py b/source4/scripting/python/samba/netcmd/delegation.py index 24f4f51937..0aed394657 100644 --- a/source4/scripting/python/samba/netcmd/delegation.py +++ b/source4/scripting/python/samba/netcmd/delegation.py @@ -36,11 +36,10 @@ from samba.netcmd import ( ) - class cmd_delegation_show(Command): """Show the delegation setting of an account.""" - - synopsis = "%prog delegation show <accountname> [options]" + + synopsis = "%prog show <accountname> [options]" takes_args = ["accountname"] @@ -74,11 +73,10 @@ class cmd_delegation_show(Command): self.outf.write("msDS-AllowedToDelegateTo: %s\n" % a) - class cmd_delegation_for_any_service(Command): """Set/unset UF_TRUSTED_FOR_DELEGATION for an account.""" - synopsis = "%prog delegation for-any-service <accountname> [(on|off)] [options]" + synopsis = "%prog <accountname> [(on|off)] [options]" takes_args = ["accountname", "onoff"] @@ -109,11 +107,10 @@ class cmd_delegation_for_any_service(Command): raise CommandError(err) - class cmd_delegation_for_any_protocol(Command): """Set/unset UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION (S4U2Proxy) for an account.""" - synopsis = "%prog delegation for-any-protocol <accountname> [(on|off)] [options]" + synopsis = "%prog <accountname> [(on|off)] [options]" takes_args = ["accountname", "onoff"] @@ -144,11 +141,10 @@ class cmd_delegation_for_any_protocol(Command): raise CommandError(err) - class cmd_delegation_add_service(Command): """Add a service principal as msDS-AllowedToDelegateTo""" - synopsis = "%prog delegation add-service <accountname> <principal> [options]" + synopsis = "%prog <accountname> <principal> [options]" takes_args = ["accountname", "principal"] @@ -180,11 +176,10 @@ class cmd_delegation_add_service(Command): raise CommandError(err) - class cmd_delegation_del_service(Command): """Delete a service principal as msDS-AllowedToDelegateTo""" - synopsis = "%prog delegation del-service <accountname> <principal> [options]" + synopsis = "%prog <accountname> <principal> [options]" takes_args = ["accountname", "principal"] @@ -216,7 +211,6 @@ class cmd_delegation_del_service(Command): raise CommandError(err) - class cmd_delegation(SuperCommand): """Delegation management""" diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index 77026b9839..ce9d7d8682 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -62,7 +62,7 @@ def get_testparm_var(testparm, smbconf, varname): class cmd_domain_export_keytab(Command): """Dumps kerberos keys of the domain into a keytab""" - synopsis = "%prog domain exportkeytab <keytab> [options]" + synopsis = "%prog <keytab> [options]" takes_options = [ ] @@ -79,7 +79,7 @@ class cmd_domain_export_keytab(Command): class cmd_domain_join(Command): """Joins domain as either member or backup domain controller *""" - synopsis = "%prog domain join <dnsdomain> [DC|RODC|MEMBER|SUBDOMAIN] [options]" + synopsis = "%prog <dnsdomain> [DC|RODC|MEMBER|SUBDOMAIN] [options]" takes_options = [ Option("--server", help="DC to join", type=str), @@ -140,7 +140,7 @@ class cmd_domain_join(Command): class cmd_domain_level(Command): """Raises domain and forest function levels""" - synopsis = "%prog domain level (show|raise <options>) [options]" + synopsis = "%prog (show|raise <options>) [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -339,7 +339,7 @@ class cmd_domain_level(Command): class cmd_domain_machinepassword(Command): """Gets a machine password out of our SAM""" - synopsis = "%prog domain machinepassword <accountname> [options]" + synopsis = "%prog <accountname> [options]" takes_args = ["secret"] @@ -370,7 +370,7 @@ class cmd_domain_passwordsettings(Command): and maximum password age) on a Samba4 server. """ - synopsis = "%prog domain passwordsettings (show|set <options>) [options]" + synopsis = "%prog (show|set <options>) [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -534,7 +534,7 @@ class cmd_domain_samba3upgrade(Command): samba3 testparm utility (with --testparm). """ - synopsis = "%prog domain samba3upgrade [options] <samba3_smb_conf>" + synopsis = "%prog [options] <samba3_smb_conf>" takes_optiongroups = { "sambaopts": options.SambaOptions, diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py index 78b998e0f5..2f0e3066ae 100644 --- a/source4/scripting/python/samba/netcmd/drs.py +++ b/source4/scripting/python/samba/netcmd/drs.py @@ -101,7 +101,7 @@ def get_dsServiceName(samdb): class cmd_drs_showrepl(Command): """show replication status""" - synopsis = "%prog drs showrepl [<DC>] [options]" + synopsis = "%prog [<DC>] [options]" takes_args = ["DC?"] @@ -206,7 +206,7 @@ class cmd_drs_showrepl(Command): class cmd_drs_kcc(Command): """trigger knowledge consistency center run""" - synopsis = "%prog drs kcc [<DC>] [options]" + synopsis = "%prog [<DC>] [options]" takes_args = ["DC?"] @@ -269,7 +269,7 @@ def drs_local_replicate(self, SOURCE_DC, NC): class cmd_drs_replicate(Command): """replicate a naming context between two DCs""" - synopsis = "%prog drs replicate <destinationDC> <sourceDC> <NC> [options]" + synopsis = "%prog <destinationDC> <sourceDC> <NC> [options]" takes_args = ["DEST_DC", "SOURCE_DC", "NC"] @@ -344,7 +344,7 @@ class cmd_drs_replicate(Command): class cmd_drs_bind(Command): """show DRS capabilities of a server""" - synopsis = "%prog drs bind [<DC>] [options]" + synopsis = "%prog [<DC>] [options]" takes_args = ["DC?"] @@ -437,7 +437,7 @@ class cmd_drs_bind(Command): class cmd_drs_options(Command): """query or change 'options' for NTDS Settings object of a domain controller""" - synopsis = ("%prog drs options [<DC>] [options]") + synopsis = "%prog [<DC>] [options]" takes_args = ["DC?"] diff --git a/source4/scripting/python/samba/netcmd/dsacl.py b/source4/scripting/python/samba/netcmd/dsacl.py index 97d4eb8534..b68af9ba39 100644 --- a/source4/scripting/python/samba/netcmd/dsacl.py +++ b/source4/scripting/python/samba/netcmd/dsacl.py @@ -50,7 +50,7 @@ from samba.netcmd import ( class cmd_dsacl_set(Command): """Modify access list on a directory object""" - synopsis = "%prog dsacl set [options]" + synopsis = "%prog [options]" car_help = """ The access control right to allow or deny """ takes_options = [ diff --git a/source4/scripting/python/samba/netcmd/fsmo.py b/source4/scripting/python/samba/netcmd/fsmo.py index e8e24b2de1..4449a306a9 100644 --- a/source4/scripting/python/samba/netcmd/fsmo.py +++ b/source4/scripting/python/samba/netcmd/fsmo.py @@ -34,11 +34,10 @@ from samba.netcmd import ( from samba.samdb import SamDB - class cmd_fsmo_seize(Command): """Seize the role""" - - synopsis = "%prog fsmo seize [options]" + + synopsis = "%prog [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -99,7 +98,7 @@ all=all of the above"""), def run(self, force=None, H=None, role=None, credopts=None, sambaopts=None, versionopts=None): - + lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) @@ -116,11 +115,10 @@ all=all of the above"""), self.seize_role(role, samdb, force) - class cmd_fsmo_show(Command): """Show the roles""" - synopsis = "%prog fsmo show [options]" + synopsis = "%prog [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -129,8 +127,7 @@ class cmd_fsmo_show(Command): takes_args = [] - def run(self, H=None, - credopts=None, sambaopts=None, versionopts=None): + def run(self, H=None, credopts=None, sambaopts=None, versionopts=None): lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp, fallback_machine=True) @@ -173,13 +170,12 @@ class cmd_fsmo_show(Command): self.message("PdcEmulationMasterRole owner: " + self.pdcEmulator) self.message("DomainNamingMasterRole owner: " + self.namingMaster) self.message("SchemaMasterRole owner: " + self.schemaMaster) - class cmd_fsmo_transfer(Command): """Transfer the role""" - synopsis = "%prog fsmo transfer [options]" + synopsis = "%prog [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -252,7 +248,6 @@ all=all of the above"""), self.transfer_role(role, samdb) - class cmd_fsmo(SuperCommand): """Flexible Single Master Operations (FSMO) roles management""" diff --git a/source4/scripting/python/samba/netcmd/gpo.py b/source4/scripting/python/samba/netcmd/gpo.py index 0d96dbc56f..f87d192ff7 100644 --- a/source4/scripting/python/samba/netcmd/gpo.py +++ b/source4/scripting/python/samba/netcmd/gpo.py @@ -237,7 +237,7 @@ def create_directory_hier(conn, remotedir): class cmd_listall(Command): """list all GPOs""" - synopsis = "%prog gpo listall [options]" + synopsis = "%prog [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -268,13 +268,13 @@ class cmd_listall(Command): class cmd_list(Command): """list GPOs for an account""" - synopsis = "%prog gpo list <username> [options]" + synopsis = "%prog <username> [options]" - takes_args = [ 'username' ] + takes_args = ['username'] takes_options = [ - Option("-H", "--URL", help="LDB URL for database or target server", type=str, - metavar="URL", dest="H") + Option("-H", "--URL", help="LDB URL for database or target server", + type=str, metavar="URL", dest="H") ] def run(self, username, H=None, sambaopts=None, credopts=None, versionopts=None): @@ -377,7 +377,7 @@ class cmd_list(Command): class cmd_show(Command): """Show information for a GPO""" - synopsis = "%prog gpo show <gpo> [options]" + synopsis = "%prog <gpo> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -385,7 +385,7 @@ class cmd_show(Command): "credopts": options.CredentialsOptions, } - takes_args = [ 'gpo' ] + takes_args = ['gpo'] takes_options = [ Option("-H", help="LDB URL for database or target server", type=str) @@ -421,7 +421,7 @@ class cmd_show(Command): class cmd_getlink(Command): """List GPO Links for a container""" - synopsis = "%prog gpo getlink <container_dn> [options]" + synopsis = "%prog <container_dn> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -429,7 +429,7 @@ class cmd_getlink(Command): "credopts": options.CredentialsOptions, } - takes_args = [ 'container_dn' ] + takes_args = ['container_dn'] takes_options = [ Option("-H", help="LDB URL for database or target server", type=str) @@ -468,7 +468,7 @@ class cmd_getlink(Command): class cmd_setlink(Command): """Add or Update a GPO link to a container""" - synopsis = "%prog gpo setlink <container_dn> <gpo> [options]" + synopsis = "%prog <container_dn> <gpo> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -476,7 +476,7 @@ class cmd_setlink(Command): "credopts": options.CredentialsOptions, } - takes_args = [ 'container_dn', 'gpo' ] + takes_args = ['container_dn', 'gpo'] takes_options = [ Option("-H", help="LDB URL for database or target server", type=str), @@ -556,7 +556,7 @@ class cmd_setlink(Command): class cmd_dellink(Command): """Delete GPO link from a container""" - synopsis = "%prog gpo dellink <container_dn> <gpo> [options]" + synopsis = "%prog <container_dn> <gpo> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -564,7 +564,7 @@ class cmd_dellink(Command): "credopts": options.CredentialsOptions, } - takes_args = [ 'container_dn', 'gpo' ] + takes_args = ['container_dn', 'gpo'] takes_options = [ Option("-H", help="LDB URL for database or target server", type=str), @@ -625,7 +625,7 @@ class cmd_dellink(Command): class cmd_getinheritance(Command): """Get inheritance flag for a container""" - synopsis = "%prog gpo getinheritance <container_dn> [options]" + synopsis = "%prog <container_dn> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -633,7 +633,7 @@ class cmd_getinheritance(Command): "credopts": options.CredentialsOptions, } - takes_args = [ 'container_dn' ] + takes_args = ['container_dn'] takes_options = [ Option("-H", help="LDB URL for database or target server", type=str) @@ -669,7 +669,7 @@ class cmd_getinheritance(Command): class cmd_setinheritance(Command): """Set inheritance flag on a container""" - synopsis = "%prog gpo setinheritance <container_dn> <block|inherit> [options]" + synopsis = "%prog <container_dn> <block|inherit> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -724,7 +724,7 @@ class cmd_setinheritance(Command): class cmd_fetch(Command): """Download a GPO""" - synopsis = "%prog gpo fetch <gpo> [options]" + synopsis = "%prog <gpo> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -732,7 +732,7 @@ class cmd_fetch(Command): "credopts": options.CredentialsOptions, } - takes_args = [ 'gpo' ] + takes_args = ['gpo'] takes_options = [ Option("-H", help="LDB URL for database or target server", type=str), @@ -792,7 +792,7 @@ class cmd_fetch(Command): class cmd_create(Command): """Create an empty GPO""" - synopsis = "%prog gpo create <displayname> [options]" + synopsis = "%prog <displayname> [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, @@ -800,7 +800,7 @@ class cmd_create(Command): "credopts": options.CredentialsOptions, } - takes_args = [ 'displayname' ] + takes_args = ['displayname'] takes_options = [ Option("-H", help="LDB URL for database or target server", type=str), diff --git a/source4/scripting/python/samba/netcmd/group.py b/source4/scripting/python/samba/netcmd/group.py index db2a6d6269..ed8c318db1 100644 --- a/source4/scripting/python/samba/netcmd/group.py +++ b/source4/scripting/python/samba/netcmd/group.py @@ -43,7 +43,7 @@ distribution_group = dict({"Domain": GTYPE_DISTRIBUTION_DOMAIN_LOCAL_GROUP, "Glo class cmd_group_add(Command): """Creates a new group""" - synopsis = "%prog group add <groupname> [options]" + synopsis = "%prog <groupname> [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -88,7 +88,7 @@ class cmd_group_add(Command): class cmd_group_delete(Command): """Delete a group""" - synopsis = "%prog group delete <groupname> [options]" + synopsis = "%prog <groupname> [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -115,7 +115,7 @@ class cmd_group_delete(Command): class cmd_group_add_members(Command): """Add (comma-separated list of) group members""" - synopsis = "%prog group addmembers <groupname> <listofmembers> [options]" + synopsis = "%prog <groupname> <listofmembers> [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -144,7 +144,7 @@ class cmd_group_add_members(Command): class cmd_group_remove_members(Command): """Remove (comma-separated list of) group members""" - synopsis = "%prog group removemembers <groupname> <listofmembers> [options]" + synopsis = "%prog <groupname> <listofmembers> [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, diff --git a/source4/scripting/python/samba/netcmd/ldapcmp.py b/source4/scripting/python/samba/netcmd/ldapcmp.py index 7805eca6cf..78e6fd356b 100755 --- a/source4/scripting/python/samba/netcmd/ldapcmp.py +++ b/source4/scripting/python/samba/netcmd/ldapcmp.py @@ -850,7 +850,7 @@ class LDAPBundel(object): class cmd_ldapcmp(Command): """compare two ldap databases""" - synopsis = "%prog ldapcmp <URL1> <URL2> (domain|configuration|schema) [options]" + synopsis = "%prog <URL1> <URL2> (domain|configuration|schema) [options]" takes_optiongroups = { "sambaopts": options.SambaOptions, diff --git a/source4/scripting/python/samba/netcmd/ntacl.py b/source4/scripting/python/samba/netcmd/ntacl.py index 42187493b8..2e5b0c69aa 100644 --- a/source4/scripting/python/samba/netcmd/ntacl.py +++ b/source4/scripting/python/samba/netcmd/ntacl.py @@ -41,7 +41,7 @@ from samba.netcmd import ( class cmd_ntacl_set(Command): """Set ACLs on a file""" - synopsis = "%prog set <acl> <file> [options]" + synopsis = "%prog <acl> <file> [options]" takes_options = [ Option("--quiet", help="Be quiet", action="store_true"), @@ -77,7 +77,7 @@ class cmd_ntacl_set(Command): class cmd_ntacl_get(Command): """Set ACLs on a file""" - synopsis = "%prog get <file> [options]" + synopsis = "%prog <file> [options]" takes_options = [ Option("--as-sddl", help="Output ACL in the SDDL format", action="store_true"), diff --git a/source4/scripting/python/samba/netcmd/rodc.py b/source4/scripting/python/samba/netcmd/rodc.py index b2a5e3f720..77d469a5dd 100644 --- a/source4/scripting/python/samba/netcmd/rodc.py +++ b/source4/scripting/python/samba/netcmd/rodc.py @@ -25,15 +25,13 @@ from samba.samdb import SamDB from samba.auth import system_session import ldb from samba.dcerpc import misc, drsuapi -from samba.credentials import Credentials from samba.drs_utils import drs_Replicate - class cmd_rodc_preload(Command): """Preload one account for an RODC""" - synopsis = "%prog rodc preload (<SID>|<DN>|<accountname>) [options]" + synopsis = "%prog (<SID>|<DN>|<accountname>) [options]" takes_options = [ Option("--server", help="DC to use", type=str), diff --git a/source4/scripting/python/samba/netcmd/spn.py b/source4/scripting/python/samba/netcmd/spn.py index 614710c973..0f01a49fc4 100644 --- a/source4/scripting/python/samba/netcmd/spn.py +++ b/source4/scripting/python/samba/netcmd/spn.py @@ -33,11 +33,10 @@ from samba.netcmd import ( ) - class cmd_spn_list(Command): """List spns of a given user.""" - synopsis = "%prog spn list <user> [options]" + synopsis = "%prog <user> [options]" takes_args = ["user"] @@ -71,11 +70,10 @@ class cmd_spn_list(Command): raise CommandError("User %s not found" % user) - class cmd_spn_add(Command): """Create a new spn.""" - synopsis = "%prog spn add <name> <user> [options]" + synopsis = "%prog <name> <user> [options]" takes_options = [ Option("--force", help="Force the addition of the spn"\ @@ -126,11 +124,10 @@ class cmd_spn_add(Command): raise CommandError("User %s not found" % user) - class cmd_spn_delete(Command): """Delete a spn.""" - synopsis = "%prog spn delete <name> [user] [options]" + synopsis = "%prog <name> [user] [options]" takes_args = ["name", "user?"] @@ -181,7 +178,6 @@ class cmd_spn_delete(Command): raise CommandError("Service principal %s not affected" % name) - class cmd_spn(SuperCommand): """Service Principal Name (SPN) management""" diff --git a/source4/scripting/python/samba/netcmd/testparm.py b/source4/scripting/python/samba/netcmd/testparm.py index b69c351538..517196652b 100755 --- a/source4/scripting/python/samba/netcmd/testparm.py +++ b/source4/scripting/python/samba/netcmd/testparm.py @@ -44,7 +44,7 @@ from samba.netcmd import Command, CommandError, Option class cmd_testparm(Command): """Syntax check the configuration file.""" - synopsis = "%prog testparm [options]" + synopsis = "%prog [options]" takes_optiongroups = { "sambaopts" : options.SambaOptions, diff --git a/source4/scripting/python/samba/netcmd/time.py b/source4/scripting/python/samba/netcmd/time.py index 31a6f7c627..62d4d1ba3c 100644 --- a/source4/scripting/python/samba/netcmd/time.py +++ b/source4/scripting/python/samba/netcmd/time.py @@ -29,7 +29,7 @@ from samba.netcmd import ( class cmd_time(Command): """Retrieve the time on a remote server""" - synopsis = "%prog time [server-name] [options]" + synopsis = "%prog [server-name] [options]" takes_args = ["server_name?"] diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py index 215fd15533..cbac5affbe 100644 --- a/source4/scripting/python/samba/netcmd/user.py +++ b/source4/scripting/python/samba/netcmd/user.py @@ -36,11 +36,10 @@ from samba.netcmd import ( ) - class cmd_user_add(Command): """Creates a new user""" - synopsis = "%prog user add <username> [<password>] [options]" + synopsis = "%prog <username> [<password>] [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -107,7 +106,7 @@ class cmd_user_add(Command): class cmd_user_delete(Command): """Delete a user""" - synopsis = "%prog user delete <username> [options]" + synopsis = "%prog <username> [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -133,7 +132,7 @@ class cmd_user_delete(Command): class cmd_user_enable(Command): """Enables a user""" - synopsis = "%prog user enable (<username>|--filter <filter>) [options]" + synopsis = "%prog (<username>|--filter <filter>) [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -166,7 +165,7 @@ class cmd_user_enable(Command): class cmd_user_setexpiry(Command): """Sets the expiration of a user account""" - synopsis = "%prog user setexpiry (<username>|--filter <filter>) [options]" + synopsis = "%prog (<username>|--filter <filter>) [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -205,7 +204,7 @@ class cmd_user_setexpiry(Command): class cmd_user_password(Command): """Change password for a user account (the one provided in authentication)""" - synopsis = "%prog user password [options]" + synopsis = "%prog [options]" takes_options = [ Option("--newpassword", help="New password", type=str), @@ -239,7 +238,7 @@ class cmd_user_password(Command): class cmd_user_setpassword(Command): """(Re)sets the password of a user account""" - synopsis = "%prog user setpassword (<username>|--filter <filter>) [options]" + synopsis = "%prog (<username>|--filter <filter>) [options]" takes_options = [ Option("-H", "--URL", help="LDB URL for database or target server", type=str, @@ -286,7 +285,6 @@ class cmd_user_setpassword(Command): self.outf.write("Changed password OK\n") - class cmd_user(SuperCommand): """User management""" diff --git a/source4/scripting/python/samba/netcmd/vampire.py b/source4/scripting/python/samba/netcmd/vampire.py index dc522ff5d1..22a180a700 100644 --- a/source4/scripting/python/samba/netcmd/vampire.py +++ b/source4/scripting/python/samba/netcmd/vampire.py @@ -30,9 +30,10 @@ from samba.netcmd import ( CommandError ) + class cmd_vampire(Command): """Join and synchronise a remote AD domain to the local server""" - synopsis = "%prog vampire [options] <domain>" + synopsis = "%prog [options] <domain>" takes_options = [ Option("--target-dir", help="Target directory.", type=str), |