1e7e9171eSGeorge Keishing#!/usr/bin/env python3
27d68d00bSMichael Walsh
3e635ddc0SGeorge Keishingfrom gen_arg import *
4*20f38712SPatrick Williamsfrom gen_print import *
56db1b7d0SMichael Walshfrom gen_valid import *
62d8d7f3cSMichael Walsh
77d68d00bSMichael Walshparser = argparse.ArgumentParser(
8*20f38712SPatrick Williams    usage="%(prog)s [OPTIONS]",
97d68d00bSMichael Walsh    description="%(prog)s will...",
10d0741f8aSMichael Walsh    formatter_class=argparse.ArgumentDefaultsHelpFormatter,
11*20f38712SPatrick Williams    prefix_chars="-+",
12*20f38712SPatrick Williams)
137d68d00bSMichael Walsh
14*20f38712SPatrick Williamsparser.add_argument("--whatever", default="", help="bla, bla.")
157d68d00bSMichael Walsh
1641dda1b0SMichael Walsh# Populate stock_list with options we want.
177d68d00bSMichael Walshstock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
187d68d00bSMichael Walsh
197d68d00bSMichael Walsh
20ee24ff55SMichael Walshdef exit_function():
217d68d00bSMichael Walsh    r"""
226db1b7d0SMichael Walsh    Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).  This
236db1b7d0SMichael Walsh    function will be called by gen_exit_function().
247d68d00bSMichael Walsh    """
257d68d00bSMichael Walsh
266db1b7d0SMichael Walsh    # If you have no cleanup to do, you can delete this function altogether.
277d68d00bSMichael Walsh
287d68d00bSMichael Walsh    # Your cleanup code here.
297d68d00bSMichael Walsh
307d68d00bSMichael Walsh
317d68d00bSMichael Walshdef validate_parms():
327d68d00bSMichael Walsh    r"""
336db1b7d0SMichael Walsh    Validate program parameters, etc.  This function will be called by gen_setup().
347d68d00bSMichael Walsh    """
357d68d00bSMichael Walsh
366db1b7d0SMichael Walsh    # If you have no validation to do, you can delete this function altogether.
376607a28eSMichael Walsh
382d8d7f3cSMichael Walsh    # Your validation code here...
392d8d7f3cSMichael Walsh    # valid_value(whatever)
407d68d00bSMichael Walsh
417d68d00bSMichael Walsh
427d68d00bSMichael Walshdef main():
436607a28eSMichael Walsh    gen_setup()
447d68d00bSMichael Walsh
457d68d00bSMichael Walsh    # Your code here.
467d68d00bSMichael Walsh
477d68d00bSMichael Walsh
482d8d7f3cSMichael Walshmain()
49