blob: 11db412b859b44b6c20cd8aeda54911c0e9c905f [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"""
35 Execute whenever the program ends normally or with the signals that we
36 catch (i.e. TERM, INT).
37 """
38
Michael Walsh6607a282019-09-13 14:21:01 -050039 # This function will be called by gen_exit_function(). If you have no
40 # cleanup to do, you can delete this function altogether.
Michael Walsh4cae87d2017-01-12 14:46:05 -060041
42 # Your cleanup code here.
43
Michael Walsh4cae87d2017-01-12 14:46:05 -060044
Michael Walsh4cae87d2017-01-12 14:46:05 -060045def validate_parms():
Michael Walsh4cae87d2017-01-12 14:46:05 -060046 r"""
Michael Walsh2d8d7f32018-06-01 15:21:09 -050047 Validate program parameters, etc.
Michael Walsh4cae87d2017-01-12 14:46:05 -060048 """
49
Michael Walsh6607a282019-09-13 14:21:01 -050050 # This function will be called by gen_setup(). If you have no validation
51 # to do, you can delete this function altogether.
52
Michael Walsh2d8d7f32018-06-01 15:21:09 -050053 # Your validation code here...
54 # valid_value(whatever)
Michael Walsh4cae87d2017-01-12 14:46:05 -060055
Michael Walsh4cae87d2017-01-12 14:46:05 -060056
Michael Walsh4cae87d2017-01-12 14:46:05 -060057def main():
58
Michael Walsh6607a282019-09-13 14:21:01 -050059 gen_setup()
Michael Walsh4cae87d2017-01-12 14:46:05 -060060
61 # Your code here.
62
Michael Walsh4cae87d2017-01-12 14:46:05 -060063
Michael Walsh2d8d7f32018-06-01 15:21:09 -050064main()