blob: fcd0c6f7d1066af64cbeab41f0b82091226e3b2f [file] [log] [blame]
George Keishinge7e91712021-09-03 11:28:44 -05001#!/usr/bin/env python3
Michael Walsh4cae87d2017-01-12 14:46:05 -06002
Patrick Williams57318182022-12-08 06:18:26 -06003from gen_print import *
George Keishinge635ddc2022-12-08 07:38:02 -06004from gen_arg 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(
George Keishinge635ddc2022-12-08 07:38:02 -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,
George Keishinge635ddc2022-12-08 07:38:02 -060011 prefix_chars='-+')
Michael Walsh4cae87d2017-01-12 14:46:05 -060012
George Keishinge635ddc2022-12-08 07:38:02 -060013parser.add_argument(
14 '--whatever',
15 default='',
16 help='bla, bla.')
Michael Walsh4cae87d2017-01-12 14:46:05 -060017
Michael Walsh41dda1b2017-09-14 11:42:29 -050018# Populate stock_list with options we want.
Michael Walsh4cae87d2017-01-12 14:46:05 -060019stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
Michael Walsh4cae87d2017-01-12 14:46:05 -060020
21
Michael Walshee24ff52019-12-13 14:42:59 -060022def exit_function():
Michael Walsh4cae87d2017-01-12 14:46:05 -060023 r"""
Michael Walsh6db1b7d2020-02-18 11:51:23 -060024 Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT). This
25 function will be called by gen_exit_function().
Michael Walsh4cae87d2017-01-12 14:46:05 -060026 """
27
Michael Walsh6db1b7d2020-02-18 11:51:23 -060028 # If you have no cleanup to do, you can delete this function altogether.
Michael Walsh4cae87d2017-01-12 14:46:05 -060029
30 # Your cleanup code here.
31
Michael Walsh4cae87d2017-01-12 14:46:05 -060032
Michael Walsh4cae87d2017-01-12 14:46:05 -060033def validate_parms():
Michael Walsh4cae87d2017-01-12 14:46:05 -060034 r"""
Michael Walsh6db1b7d2020-02-18 11:51:23 -060035 Validate program parameters, etc. This function will be called by gen_setup().
Michael Walsh4cae87d2017-01-12 14:46:05 -060036 """
37
Michael Walsh6db1b7d2020-02-18 11:51:23 -060038 # If you have no validation to do, you can delete this function altogether.
Michael Walsh6607a282019-09-13 14:21:01 -050039
Michael Walsh2d8d7f32018-06-01 15:21:09 -050040 # Your validation code here...
41 # valid_value(whatever)
Michael Walsh4cae87d2017-01-12 14:46:05 -060042
Michael Walsh4cae87d2017-01-12 14:46:05 -060043
Michael Walsh4cae87d2017-01-12 14:46:05 -060044def main():
George Keishinge635ddc2022-12-08 07:38:02 -060045
Michael Walsh6607a282019-09-13 14:21:01 -050046 gen_setup()
Michael Walsh4cae87d2017-01-12 14:46:05 -060047
48 # Your code here.
49
Michael Walsh4cae87d2017-01-12 14:46:05 -060050
Michael Walsh2d8d7f32018-06-01 15:21:09 -050051main()