17d68d00bSMichael Walsh#!/usr/bin/env python
27d68d00bSMichael Walsh
3*6db1b7d0SMichael Walshfrom gen_print import *
4*6db1b7d0SMichael Walshfrom gen_arg import *
5*6db1b7d0SMichael Walshfrom gen_valid import *
62d8d7f3cSMichael Walsh
77d68d00bSMichael Walshparser = argparse.ArgumentParser(
87d68d00bSMichael Walsh    usage='%(prog)s [OPTIONS]',
97d68d00bSMichael Walsh    description="%(prog)s will...",
10d0741f8aSMichael Walsh    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
117d68d00bSMichael Walsh    prefix_chars='-+')
127d68d00bSMichael Walsh
137d68d00bSMichael Walshparser.add_argument(
147d68d00bSMichael Walsh    '--whatever',
152d8d7f3cSMichael Walsh    default='',
167d68d00bSMichael Walsh    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"""
24*6db1b7d0SMichael Walsh    Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).  This
25*6db1b7d0SMichael Walsh    function will be called by gen_exit_function().
267d68d00bSMichael Walsh    """
277d68d00bSMichael Walsh
28*6db1b7d0SMichael 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"""
35*6db1b7d0SMichael Walsh    Validate program parameters, etc.  This function will be called by gen_setup().
367d68d00bSMichael Walsh    """
377d68d00bSMichael Walsh
38*6db1b7d0SMichael 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():
457d68d00bSMichael Walsh
466607a28eSMichael Walsh    gen_setup()
477d68d00bSMichael Walsh
487d68d00bSMichael Walsh    # Your code here.
497d68d00bSMichael Walsh
507d68d00bSMichael Walsh
512d8d7f3cSMichael Walshmain()
52