Change python_pgm_template to use exit_on_error mode
Change-Id: Ib7d64cfbcefe110a9187e4e62bcce7946b5a2931
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/templates/python_pgm_template b/templates/python_pgm_template
index f1cfbd5..2b19948 100644
--- a/templates/python_pgm_template
+++ b/templates/python_pgm_template
@@ -17,6 +17,9 @@
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
+# Set exit_on_error for gen_valid functions.
+set_exit_on_error(True)
+
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
description="%(prog)s will...",
@@ -25,6 +28,7 @@
parser.add_argument(
'--whatever',
+ default='',
help='bla, bla.')
# Populate stock_list with options we want.
@@ -66,33 +70,24 @@
def validate_parms():
r"""
- Validate program parameters, etc. Return True or False (i.e. pass/fail)
- accordingly.
+ Validate program parameters, etc.
"""
- # Your validation code here.
+ # Your validation code here...
+ # valid_value(whatever)
gen_post_validation(exit_function, signal_handler)
- return True
-
def main():
- if not gen_get_options(parser, stock_list):
- return False
+ gen_get_options(parser, stock_list)
- if not validate_parms():
- return False
+ validate_parms()
qprint_pgm_header()
# Your code here.
- return True
-
-# Main
-
-if not main():
- exit(1)
+main()