-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplate.py
40 lines (31 loc) · 1.13 KB
/
template.py
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
#!/usr/bin/env python
"""
Copyright(c)2010 Mike McCabe. Software license AGPL version 3.
"""
def main(argv):
import optparse
parser = optparse.OptionParser(usage='usage: %prog [options] arg1 arg2',
version='%prog 0.1',
description='description goes here.')
parser.add_option('-f', '--foo',
action='store_true',
default=False,
dest='foo',
help='Do the foo thing')
parser.add_option('-i', '--intr',
action='store',
default=14,
dest='introo',
metavar='scoobage', # this shows up in help text
type='int',
help='test how int args work ... defaults to %default')
opts, args = parser.parse_args(argv)
print opts, args
if opts.a and opts.b:
parser.error("options -a and -b are mutually exclusive")
parser.destroy()
dostuff(opts, args)
def dostuff(opts, args):
pass
if __name__ == '__main__':
main(sys.argv[1:])