1#!/usr/bin/env python 2 3r""" 4See help text for details. 5""" 6 7import sys 8 9save_dir_path = sys.path.pop(0) 10 11modules = ['gen_arg', 'gen_print', 'gen_valid'] 12for module in modules: 13 exec("from " + module + " import *") 14 15sys.path.insert(0, save_dir_path) 16 17parser = argparse.ArgumentParser( 18 usage='%(prog)s [OPTIONS]', 19 description="%(prog)s will...", 20 formatter_class=argparse.ArgumentDefaultsHelpFormatter, 21 prefix_chars='-+') 22 23parser.add_argument( 24 '--whatever', 25 default='', 26 help='bla, bla.') 27 28# Populate stock_list with options we want. 29stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)] 30 31 32def exit_function(signal_number=0, 33 frame=None): 34 r""" 35 Execute whenever the program ends normally or with the signals that we 36 catch (i.e. TERM, INT). 37 """ 38 39 # This function will be called by gen_exit_function(). If you have no 40 # cleanup to do, you can delete this function altogether. 41 42 # Your cleanup code here. 43 44 45def validate_parms(): 46 r""" 47 Validate program parameters, etc. 48 """ 49 50 # This function will be called by gen_setup(). If you have no validation 51 # to do, you can delete this function altogether. 52 53 # Your validation code here... 54 # valid_value(whatever) 55 56 57def main(): 58 59 gen_setup() 60 61 # Your code here. 62 63 64main() 65