terom@48: """ terom@48: Main entry point for the command-line interface terom@48: """ terom@48: terom@48: import commands terom@48: terom@48: from optparse import OptionParser terom@48: terom@48: def option_parser (command_name) : terom@48: """ terom@48: Build the OptionParser that we use terom@48: """ terom@48: terom@48: # create parser using the given command terom@48: parser = OptionParser(prog=command_name) terom@48: terom@48: # define options terom@48: parser.add_option('-d', "--dir", dest='dir', help="Use DIR as the image/HTML path [default: CWD]", metavar='DIR', default='.') terom@48: terom@48: return parser terom@48: terom@48: def main (argv) : terom@48: """ terom@48: Main entry point terom@48: """ terom@48: terom@48: # build optparser terom@48: parser = option_parser(argv[0]) terom@48: terom@48: # parse the given argv terom@48: options, filter_targets = parser.parse_args(argv[1:]) terom@48: terom@48: # run the selected command terom@48: return commands.main(options.dir, filter_targets) terom@48: