-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathpython_pgm_template
51 lines (33 loc) · 1.08 KB
/
python_pgm_template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
from gen_print import *
from gen_arg import *
from gen_valid import *
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
description="%(prog)s will...",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prefix_chars='-+')
parser.add_argument(
'--whatever',
default='',
help='bla, bla.')
# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
def exit_function():
r"""
Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT). This
function will be called by gen_exit_function().
"""
# If you have no cleanup to do, you can delete this function altogether.
# Your cleanup code here.
def validate_parms():
r"""
Validate program parameters, etc. This function will be called by gen_setup().
"""
# If you have no validation to do, you can delete this function altogether.
# Your validation code here...
# valid_value(whatever)
def main():
gen_setup()
# Your code here.
main()