blob: fc2cf79808b565262f8064add3a4c76eae1b7c4b [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 Walshee24ff52019-12-13 14:42:59 -060032def exit_function():
Michael Walsh4cae87d2017-01-12 14:46:05 -060033 r"""
Michael Walsh410b1782019-10-22 15:56:18 -050034 Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
Michael Walsh4cae87d2017-01-12 14:46:05 -060035 """
36
Michael Walsh410b1782019-10-22 15:56:18 -050037 # This function will be called by gen_exit_function(). If you have no cleanup to do, you can delete
38 # this function altogether.
Michael Walsh4cae87d2017-01-12 14:46:05 -060039
40 # Your cleanup code here.
41
Michael Walsh4cae87d2017-01-12 14:46:05 -060042
Michael Walsh4cae87d2017-01-12 14:46:05 -060043def validate_parms():
Michael Walsh4cae87d2017-01-12 14:46:05 -060044 r"""
Michael Walsh2d8d7f32018-06-01 15:21:09 -050045 Validate program parameters, etc.
Michael Walsh4cae87d2017-01-12 14:46:05 -060046 """
47
Michael Walsh410b1782019-10-22 15:56:18 -050048 # This function will be called by gen_setup(). If you have no validation to do, you can delete this
49 # function altogether.
Michael Walsh6607a282019-09-13 14:21:01 -050050
Michael Walsh2d8d7f32018-06-01 15:21:09 -050051 # Your validation code here...
52 # valid_value(whatever)
Michael Walsh4cae87d2017-01-12 14:46:05 -060053
Michael Walsh4cae87d2017-01-12 14:46:05 -060054
Michael Walsh4cae87d2017-01-12 14:46:05 -060055def main():
56
Michael Walsh6607a282019-09-13 14:21:01 -050057 gen_setup()
Michael Walsh4cae87d2017-01-12 14:46:05 -060058
59 # Your code here.
60
Michael Walsh4cae87d2017-01-12 14:46:05 -060061
Michael Walsh2d8d7f32018-06-01 15:21:09 -050062main()