blob: b7fe32f76fc355f925a0e2609afc0ae506ff96a1 [file] [log] [blame]
Michael Walsh4cae87d2017-01-12 14:46:05 -06001#!/usr/bin/env python
2
3r"""
Michael Walshe5391dc2019-07-22 17:18:30 -05004See help text for details.
Michael Walsh4cae87d2017-01-12 14:46:05 -06005"""
6
7import sys
8
Michael Walsh6607a282019-09-13 14:21:01 -05009save_dir_path = sys.path.pop(0)
Michael Walsh4cae87d2017-01-12 14:46:05 -060010
Michael Walsh6607a282019-09-13 14:21:01 -050011modules = ['gen_arg', 'gen_print', 'gen_valid']
12for module in modules:
13 exec("from " + module + " import *")
Michael Walsh4cae87d2017-01-12 14:46:05 -060014
Michael Walsh6607a282019-09-13 14:21:01 -050015sys.path.insert(0, save_dir_path)
Michael Walsh2d8d7f32018-06-01 15:21:09 -050016
Michael Walsh4cae87d2017-01-12 14:46:05 -060017parser = argparse.ArgumentParser(
18 usage='%(prog)s [OPTIONS]',
19 description="%(prog)s will...",
Michael Walshd0741f82017-12-21 14:04:21 -060020 formatter_class=argparse.ArgumentDefaultsHelpFormatter,
Michael Walsh4cae87d2017-01-12 14:46:05 -060021 prefix_chars='-+')
22
Michael Walsh4cae87d2017-01-12 14:46:05 -060023parser.add_argument(
24 '--whatever',
Michael Walsh2d8d7f32018-06-01 15:21:09 -050025 default='',
Michael Walsh4cae87d2017-01-12 14:46:05 -060026 help='bla, bla.')
27
Michael Walsh41dda1b2017-09-14 11:42:29 -050028# Populate stock_list with options we want.
Michael Walsh4cae87d2017-01-12 14:46:05 -060029stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
Michael Walsh4cae87d2017-01-12 14:46:05 -060030
31
Michael Walsh4cae87d2017-01-12 14:46:05 -060032def exit_function(signal_number=0,
33 frame=None):
Michael Walsh4cae87d2017-01-12 14:46:05 -060034 r"""
Michael Walsh410b1782019-10-22 15:56:18 -050035 Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
Michael Walsh4cae87d2017-01-12 14:46:05 -060036 """
37
Michael Walsh410b1782019-10-22 15:56:18 -050038 # This function will be called by gen_exit_function(). If you have no cleanup to do, you can delete
39 # this function altogether.
Michael Walsh4cae87d2017-01-12 14:46:05 -060040
41 # Your cleanup code here.
42
Michael Walsh4cae87d2017-01-12 14:46:05 -060043
Michael Walsh4cae87d2017-01-12 14:46:05 -060044def validate_parms():
Michael Walsh4cae87d2017-01-12 14:46:05 -060045 r"""
Michael Walsh2d8d7f32018-06-01 15:21:09 -050046 Validate program parameters, etc.
Michael Walsh4cae87d2017-01-12 14:46:05 -060047 """
48
Michael Walsh410b1782019-10-22 15:56:18 -050049 # This function will be called by gen_setup(). If you have no validation to do, you can delete this
50 # function altogether.
Michael Walsh6607a282019-09-13 14:21:01 -050051
Michael Walsh2d8d7f32018-06-01 15:21:09 -050052 # Your validation code here...
53 # valid_value(whatever)
Michael Walsh4cae87d2017-01-12 14:46:05 -060054
Michael Walsh4cae87d2017-01-12 14:46:05 -060055
Michael Walsh4cae87d2017-01-12 14:46:05 -060056def main():
57
Michael Walsh6607a282019-09-13 14:21:01 -050058 gen_setup()
Michael Walsh4cae87d2017-01-12 14:46:05 -060059
60 # Your code here.
61
Michael Walsh4cae87d2017-01-12 14:46:05 -060062
Michael Walsh2d8d7f32018-06-01 15:21:09 -050063main()