1e7e9171eSGeorge Keishing#!/usr/bin/env python3 27d68d00bSMichael Walsh 35731818dSPatrick Williamsfrom gen_print import * 4*e635ddc0SGeorge Keishingfrom gen_arg import * 56db1b7d0SMichael Walshfrom gen_valid import * 62d8d7f3cSMichael Walsh 77d68d00bSMichael Walshparser = argparse.ArgumentParser( 8*e635ddc0SGeorge Keishing usage='%(prog)s [OPTIONS]', 97d68d00bSMichael Walsh description="%(prog)s will...", 10d0741f8aSMichael Walsh formatter_class=argparse.ArgumentDefaultsHelpFormatter, 11*e635ddc0SGeorge Keishing prefix_chars='-+') 127d68d00bSMichael Walsh 13*e635ddc0SGeorge Keishingparser.add_argument( 14*e635ddc0SGeorge Keishing '--whatever', 15*e635ddc0SGeorge Keishing default='', 16*e635ddc0SGeorge Keishing help='bla, bla.') 177d68d00bSMichael Walsh 1841dda1b0SMichael Walsh# Populate stock_list with options we want. 197d68d00bSMichael Walshstock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)] 207d68d00bSMichael Walsh 217d68d00bSMichael Walsh 22ee24ff55SMichael Walshdef exit_function(): 237d68d00bSMichael Walsh r""" 246db1b7d0SMichael Walsh Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT). This 256db1b7d0SMichael Walsh function will be called by gen_exit_function(). 267d68d00bSMichael Walsh """ 277d68d00bSMichael Walsh 286db1b7d0SMichael Walsh # If you have no cleanup to do, you can delete this function altogether. 297d68d00bSMichael Walsh 307d68d00bSMichael Walsh # Your cleanup code here. 317d68d00bSMichael Walsh 327d68d00bSMichael Walsh 337d68d00bSMichael Walshdef validate_parms(): 347d68d00bSMichael Walsh r""" 356db1b7d0SMichael Walsh Validate program parameters, etc. This function will be called by gen_setup(). 367d68d00bSMichael Walsh """ 377d68d00bSMichael Walsh 386db1b7d0SMichael Walsh # If you have no validation to do, you can delete this function altogether. 396607a28eSMichael Walsh 402d8d7f3cSMichael Walsh # Your validation code here... 412d8d7f3cSMichael Walsh # valid_value(whatever) 427d68d00bSMichael Walsh 437d68d00bSMichael Walsh 447d68d00bSMichael Walshdef main(): 45*e635ddc0SGeorge Keishing 466607a28eSMichael Walsh gen_setup() 477d68d00bSMichael Walsh 487d68d00bSMichael Walsh # Your code here. 497d68d00bSMichael Walsh 507d68d00bSMichael Walsh 512d8d7f3cSMichael Walshmain() 52