aboutsummaryrefslogtreecommitdiffstats
path: root/repsys
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2007-05-02 17:39:28 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2007-05-02 17:39:28 +0000
commit0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076 (patch)
tree7e434f732783b2398fdb44d01a1a61a9df5ca3d9 /repsys
parent91700a68924f4b2e97a18f2c3787bd885c36640c (diff)
downloadmgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar
mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar.gz
mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar.bz2
mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.tar.xz
mgarepo-0b5ebe2e1b3becfd57c15dc3d585ffcd22b47076.zip
Merged work on plugins support, including the possibility to wrap
configuration sections.
Diffstat (limited to 'repsys')
-rwxr-xr-xrepsys21
1 files changed, 20 insertions, 1 deletions
diff --git a/repsys b/repsys
index bddbf71..b266321 100755
--- a/repsys
+++ b/repsys
@@ -1,5 +1,5 @@
#!/usr/bin/python
-from RepSys import Error
+from RepSys import Error, plugins
from RepSys.command import *
import getopt
import sys
@@ -22,14 +22,32 @@ Useful commands:
Run "repsys COMMAND --help" for more information.
+Run "repsys --help-plugin" for help on loaded plugins.
+
Written by Gustavo Niemeyer <gustavo@niemeyer.net>
"""
+def plugin_help(opt, val, parser, mode):
+ if parser is None:
+ prog = sys.argv[0]
+ print "Use %s --help-plugin <plugin name>" % prog
+ print "Available plugins:"
+ print
+ for name in plugins.list():
+ print name
+ else:
+ print plugins.help(parser)
+ raise SystemExit
+
def parse_options():
parser = OptionParser(help=HELP, version="%prog "+VERSION)
parser.disable_interspersed_args()
parser.add_option("--debug", action="store_true")
+ parser.add_option("--help-plugins", action="callback", callback=plugin_help)
+ parser.add_option("--help-plugin", type="string", dest="__ignore",
+ action="callback", callback=plugin_help)
opts, args = parser.parse_args()
+ del opts.__ignore
if len(args) < 1:
parser.print_help(sys.stderr)
sys.exit(1)
@@ -52,6 +70,7 @@ def dispatch_command(command, argv, debug=0):
command_module.main()
if __name__ == "__main__":
+ plugins.load()
do_command(parse_options, dispatch_command)
# vim:et:ts=4:sw=4