diff --git a/web/hp_cmd.py b/web/hp_cmd.py new file mode 100644 index 0000000..0693c60 --- /dev/null +++ b/web/hp_cmd.py @@ -0,0 +1,31 @@ +from run import generate_csv_file_if_needed, init_console_logger +from datetime import datetime +import argparse + +if __name__ == "__main__": + hp_parser = argparse.ArgumentParser(prog='Descritpor', + description='description') + + hp_parser.add_argument('-clog', '--console-log', action='store_true') + + subparsers = hp_parser.add_subparsers(dest='hpcmd_name') + + csvgen_parser = subparsers.add_parser('csv_gen', + help='csv-gen help') + csvgen_parser.add_argument('-a', '--all') + csvgen_parser.add_argument('-t', '--target') + csvgen_parser.add_argument('-i', '--input') + csvgen_parser.add_argument('-b', '--begin') + csvgen_parser.add_argument('-e', '--end') + + args = hp_parser.parse_args() + + if args.console_log: + _logger = init_console_logger() + _logger.info("This is info") + + if args.hpcmd_name == 'csv_gen': + start_date = datetime.strptime(args.begin, '%Y%m%d') + stop_date = datetime.strptime(args.end, '%Y%m%d') + generate_csv_file_if_needed(args.target, args.input, start_date, stop_date) + -- libgit2 0.21.2