Parse commandline arguments and run the tool

    :param argv: the commandline arguments.
    :type argv: list
    :returns: None
    :rtype: None
    :raises: None

def main(argv=sys.argv[1:]):
    """Parse commandline arguments and run the tool

    :param argv: the commandline arguments.
    :type argv: list
    :returns: None
    :rtype: None
    :raises: None
    """
    parser = setup_argparse()
    args = parser.parse_args(argv)
    if args.gendochelp:
        sys.argv[0] = 'gendoc.py'
        genparser = gendoc.setup_parser()
        genparser.print_help()
        sys.exit(0)
    print 'Preparing output directories'
    print '='*80
    for odir in args.output:
        prepare_dir(odir, not args.nodelete)
    print '\nRunning gendoc'
    print '='*80
    for i, idir in enumerate(args.input):
        if i >= len(args.output):
            odir = args.output[-1]
        else:
            odir = args.output[i]
        run_gendoc(idir, odir, args.gendocargs)