So i have created a few conditional statements. As soon as i am passing in parameters via the command line , there are two if statements which is tends to meet. It should only be meeting one set of conditional statement.
The conditional statement which tend to execute as if args.execute_json_path and if args.execute_json_path and args.execute_cur_date and args.execute_pre_date. When i just pass my script name and the flaj -j, this should only run whats in the code block for if args.execute_json_path and not if args.execute_json_path and args.execute_cur_date and args.execute_pre_date.
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--execute-cur-date", action="store", required=False)
parser.add_argument("-p", "--execute-pre-date", action="store", required=False)
parser.add_argument("-j", "--execute-json-path", action="store", required=False)
parser.add_argument("-t", "--execute-test", action="store_true", required=False)
args = parser.parse_args()
if args.execute_test:
testing()
if args.execute_json_path :
generate_report.create_report()
if args.execute_json_path and args.execute_cur_date and args.execute_pre_date:
Aucun commentaire:
Enregistrer un commentaire