return 0
if opts.output is not None:
- if opts.bzip:
- output = bz2.open(opts.output, 'wt')
- elif opts.gzip:
- output = gzip.open(opts.output, 'wt')
- else:
- output = open(opts.output, 'w')
+ output = open_output(opts.output, opts)
else:
output = sys.stdout
return parser
+def open_output(output, opts):
+ """Open output file with right compression library
+ """
+ if opts.bzip:
+ return bz2.open(output, 'wt')
+ elif opts.gzip:
+ return gzip.open(output, 'wt')
+ else:
+ return open(output, 'w')
+
+
def file_generator(pattern_list):
"""Given a list of glob patterns return decompressed streams
"""