507 parser = argparse.ArgumentParser(description=__doc__)
509 parser.add_argument(
"InputDirs", nargs=
"*", action=
"store",
510 help=
"input directories [current]")
512 parser.add_argument(
'--doit', dest=
"DoIt", action=
'store_true',
513 help=
"perform the substitutions [%(default)s]")
515 parser.add_argument(
'--verbose',
'-v', dest=
"DoVerbose", action=
'store_true',
516 help=
"shows all the changes on screen [%(default)s]")
517 parser.add_argument(
'--debug', dest=
"DoDebug", action=
'store_true',
518 help=
"enables debug messages on screen")
519 parser.add_argument(
'--color',
'-U', dest=
"UseColor", action=
'store_true',
520 help=
"enables coloured output [%(default)s]")
522 parser.add_argument(
'--list', dest=
"DoList", action=
'store_true',
523 help=
"just prints the hard-coded substitutions for each processor")
524 parser.add_argument(
'--only', dest=
"SelectedProcessors", action=
'append',
525 help=
"executes only the processors with the specified name (see --list)")
526 parser.add_argument(
'--version', action=
'version',
527 version=
'%(prog)s ' + __version__)
529 arguments = parser.parse_args()
532 LoggingSetup(logging.DEBUG
if arguments.DoDebug
else logging.INFO)
534 if arguments.DoVerbose: arguments.LogMsg = logging.info
535 else: arguments.LogMsg = logging.debug
537 Processors = ProcessorsList.Global
539 Processors.SetOptions(arguments)
540 Processors.SetColors(
541 old=ANSIRed, new=ANSIGreen, source=ANSIWhite, line_no=ANSIMagenta,
544 if arguments.SelectedProcessors:
545 Processors.SelectProcessors(arguments.SelectedProcessors)
548 logging.info(
"\n".
join(Processors.Describe()))
553 if not arguments.InputDirs: arguments.InputDirs = [
'.' ]
555 for InputPath
in arguments.InputDirs:
556 Processors.ProcessDir(InputPath)