samba-tool: Don't require full prog line to be in synopsis.
[Samba/gebeck_regimport.git] / source4 / scripting / bin / samba-tool
blob9f06e8daae8ae9aa5eb7b282c073e9ab99a1500a
1 #!/usr/bin/env python
3 # Unix SMB/CIFS implementation.
4 # Copyright (C) Amitay Isaacs <amitay@gmail.com> 2011
5 # Copyright (C) Giampaolo Lauria <lauria2@yahoo.com> 2011
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 import sys
23 # Find right direction when running from source tree
24 sys.path.insert(0, "bin/python")
26 from samba import netcmd
27 from samba.netcmd import SuperCommand
28 from samba.netcmd.dbcheck import cmd_dbcheck
29 from samba.netcmd.delegation import cmd_delegation
30 from samba.netcmd.domain import cmd_domain
31 from samba.netcmd.drs import cmd_drs
32 from samba.netcmd.dsacl import cmd_dsacl
33 from samba.netcmd.fsmo import cmd_fsmo
34 from samba.netcmd.gpo import cmd_gpo
35 from samba.netcmd.group import cmd_group
36 from samba.netcmd.ldapcmp import cmd_ldapcmp
37 from samba.netcmd.ntacl import cmd_ntacl
38 from samba.netcmd.rodc import cmd_rodc
39 from samba.netcmd.spn import cmd_spn
40 from samba.netcmd.testparm import cmd_testparm
41 from samba.netcmd.time import cmd_time
42 from samba.netcmd.user import cmd_user
43 from samba.netcmd.vampire import cmd_vampire
46 class cmd_sambatool(SuperCommand):
47 """samba-tool SuperCommand"""
49 subcommands = {}
50 subcommands["dbcheck"] = cmd_dbcheck()
51 subcommands["delegation"] = cmd_delegation()
52 subcommands["domain"] = cmd_domain()
53 subcommands["drs"] = cmd_drs()
54 subcommands["dsacl"] = cmd_dsacl()
55 subcommands["fsmo"] = cmd_fsmo()
56 subcommands["gpo"] = cmd_gpo()
57 subcommands["group"] = cmd_group()
58 subcommands["ldapcmp"] = cmd_ldapcmp()
59 subcommands["ntacl"] = cmd_ntacl()
60 subcommands["rodc"] = cmd_rodc()
61 subcommands["spn"] = cmd_spn()
62 subcommands["testparm"] = cmd_testparm()
63 subcommands["time"] = cmd_time()
64 subcommands["user"] = cmd_user()
65 subcommands["vampire"] = cmd_vampire()
68 if __name__ == '__main__':
69 cmd = cmd_sambatool()
70 subcommand = None
71 args = ()
73 if len(sys.argv) > 1:
74 subcommand = sys.argv[1]
75 if len(sys.argv) > 2:
76 args = sys.argv[2:]
78 try:
79 retval = cmd._run("samba-tool", subcommand, *args)
80 except SystemExit, e:
81 retval = -1
82 except Exception, e:
83 cmd.show_command_error(e)
84 retval = 1
85 sys.exit(retval)