forked from atevanderburgt/ABFGP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
32 lines (24 loc) · 1.17 KB
/
__init__.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
__author__ = 'ian'
import sys, os
this_dir = os.path.dirname(__file__)
src = os.path.dirname(this_dir)
sys.path.append(src)
import argparse
DESCRIPTION = 'What this program does'
VERSION = '0.1'
def get_args():
argparser = argparse.ArgumentParser(description=DESCRIPTION)
# standard options
argparser.add_argument('--version', action='version', version='%(prog)s' + VERSION)
argparser.add_argument('--verbose', '-v', action='count', default=0,
help='Omit to see only fatal error messages; -v to see warnings; -vv to see warnings and progress messages')
# options to customize
argparser.add_argument('--in', '-i', dest='input', type=argparse.FileType('r'), nargs='?', default=sys.stdin,
help='Path to the input file; if omitted or -, input is read from stdin')
argparser.add_argument('--out', '-o', type=argparse.FileType('w'), nargs='?', default=sys.stdout,
help='Path to the output file; if omitted or -, output is written to stdout')
return argparser.parse_args()
if __name__ == '__main__':
args = get_args()
args.out.close()
print >> sys.stderr, sys.argv[0], 'done.'