blob: e2ded37606752c52fcdea54491626efdff7845dd [file] [log] [blame]
George Keishinge7e91712021-09-03 11:28:44 -05001#!/usr/bin/env python3
Michael Walsh4cae87d2017-01-12 14:46:05 -06002
Michael Walsh6db1b7d2020-02-18 11:51:23 -06003from gen_arg import *
Patrick Williams57318182022-12-08 06:18:26 -06004from gen_print import *
Michael Walsh6db1b7d2020-02-18 11:51:23 -06005from gen_valid import *
Michael Walsh2d8d7f32018-06-01 15:21:09 -05006
Michael Walsh4cae87d2017-01-12 14:46:05 -06007parser = argparse.ArgumentParser(
Patrick Williams57318182022-12-08 06:18:26 -06008 usage="%(prog)s [OPTIONS]",
Michael Walsh4cae87d2017-01-12 14:46:05 -06009 description="%(prog)s will...",
Michael Walshd0741f82017-12-21 14:04:21 -060010 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
Patrick Williams57318182022-12-08 06:18:26 -060011 prefix_chars="-+",
12)
Michael Walsh4cae87d2017-01-12 14:46:05 -060013
Patrick Williams57318182022-12-08 06:18:26 -060014parser.add_argument("--whatever", default="", help="bla, bla.")
Michael Walsh4cae87d2017-01-12 14:46:05 -060015
Michael Walsh41dda1b2017-09-14 11:42:29 -050016# Populate stock_list with options we want.
Michael Walsh4cae87d2017-01-12 14:46:05 -060017stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
Michael Walsh4cae87d2017-01-12 14:46:05 -060018
19
Michael Walshee24ff52019-12-13 14:42:59 -060020def exit_function():
Michael Walsh4cae87d2017-01-12 14:46:05 -060021 r"""
Michael Walsh6db1b7d2020-02-18 11:51:23 -060022 Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT). This
23 function will be called by gen_exit_function().
Michael Walsh4cae87d2017-01-12 14:46:05 -060024 """
25
Michael Walsh6db1b7d2020-02-18 11:51:23 -060026 # If you have no cleanup to do, you can delete this function altogether.
Michael Walsh4cae87d2017-01-12 14:46:05 -060027
28 # Your cleanup code here.
29
Michael Walsh4cae87d2017-01-12 14:46:05 -060030
Michael Walsh4cae87d2017-01-12 14:46:05 -060031def validate_parms():
Michael Walsh4cae87d2017-01-12 14:46:05 -060032 r"""
Michael Walsh6db1b7d2020-02-18 11:51:23 -060033 Validate program parameters, etc. This function will be called by gen_setup().
Michael Walsh4cae87d2017-01-12 14:46:05 -060034 """
35
Michael Walsh6db1b7d2020-02-18 11:51:23 -060036 # If you have no validation to do, you can delete this function altogether.
Michael Walsh6607a282019-09-13 14:21:01 -050037
Michael Walsh2d8d7f32018-06-01 15:21:09 -050038 # Your validation code here...
39 # valid_value(whatever)
Michael Walsh4cae87d2017-01-12 14:46:05 -060040
Michael Walsh4cae87d2017-01-12 14:46:05 -060041
Michael Walsh4cae87d2017-01-12 14:46:05 -060042def main():
Michael Walsh6607a282019-09-13 14:21:01 -050043 gen_setup()
Michael Walsh4cae87d2017-01-12 14:46:05 -060044
45 # Your code here.
46
Michael Walsh4cae87d2017-01-12 14:46:05 -060047
Michael Walsh2d8d7f32018-06-01 15:21:09 -050048main()