- commit
- ab4a60cccf4b87294c875d32886cb2aeaf70e04e
- parent
- fade587e14f499c79eca0fcc4401db56afd218fa
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2015-04-10 22:16
split main in functions
Diffstat
| M | cctool.py | 14 | ++++++++++++-- |
1 files changed, 12 insertions, 2 deletions
diff --git a/cctool.py b/cctool.py
@@ -339,7 +339,7 @@ class JSON(Format): 339 339 json.dump(list(data), fh, indent=4, cls=DateTimeJSONEncoder) 340 340 341 341342 -1 if __name__ == '__main__':-1 342 def parse_args(argv=None): 343 343 informats, outformats = formats() 344 344 345 345 parser = argparse.ArgumentParser(description=__doc__) @@ -353,7 +353,13 @@ if __name__ == '__main__': 353 353 help="sort entries by this field") 354 354 parser.add_argument('--merge', '-m', metavar='MERGEKEY', 355 355 help="merge entries by this field")356 -1 args = parser.parse_args()-1 356 return parser.parse_args(argv) -1 357 -1 358 -1 359 def main(): -1 360 informats, outformats = formats() -1 361 -1 362 args = parse_args() 357 363 358 364 if args.outformat is None and args.output is not None: 359 365 ext = args.output.split(os.path.extsep)[-1] @@ -398,3 +404,7 @@ if __name__ == '__main__': 398 404 except Exception as e: 399 405 log.error(e) 400 406 sys.exit(1) -1 407 -1 408 -1 409 if __name__ == '__main__': -1 410 main()