- try:
- if argv is ():
- argv = sys.argv[1:]
- if argv == []:
- raise UsageError('Missing filename')
- if "--help" in argv:
- print __doc__
- return 0
- except UsageError, err:
- print >>sys.stderr, err.msg, "(\"imago.py --help\" for help)"
- return 2
+
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('files', metavar='file', nargs='+',
+ help="image to analyse")
+ parser.add_argument('-w', type=int, default=640,
+ help="scale image to the specified width before analysis")
+ parser.add_argument('-m', '--manual', dest='manual_mode', action='store_true',
+ help="manual grid selection")
+ parser.add_argument('-d', '--debug', dest='show_all', action='store_true',
+ help="show every step of the computation")
+ parser.add_argument('-s', '--save', dest='saving', action='store_true',
+ help="save images instead of displaying them")
+ parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
+ help="report progress")
+ args = parser.parse_args()