1#!/usr/bin/env python3 2 3from gen_print import * 4from gen_arg import * 5from gen_valid import * 6 7parser = argparse.ArgumentParser( 8 usage='%(prog)s [OPTIONS]', 9 description="%(prog)s will...", 10 formatter_class=argparse.ArgumentDefaultsHelpFormatter, 11 prefix_chars='-+') 12 13parser.add_argument( 14 '--whatever', 15 default='', 16 help='bla, bla.') 17 18# Populate stock_list with options we want. 19stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)] 20 21 22def exit_function(): 23 r""" 24 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(). 26 """ 27 28 # If you have no cleanup to do, you can delete this function altogether. 29 30 # Your cleanup code here. 31 32 33def validate_parms(): 34 r""" 35 Validate program parameters, etc. This function will be called by gen_setup(). 36 """ 37 38 # If you have no validation to do, you can delete this function altogether. 39 40 # Your validation code here... 41 # valid_value(whatever) 42 43 44def main(): 45 46 gen_setup() 47 48 # Your code here. 49 50 51main() 52