Message187140
I've experimented with an argparse adaptation of profile.py:
parser = argparse.ArgumentParser(usage=usage)
parser.add_argument('-o', '--outfile', dest="outfile",
help="Save stats to <outfile>", metavar="path")
parser.add_argument('-s', '--sort', dest="sort",
help="Sort order when printing to stdout ...",
default=-1)
parser.add_argument('args', nargs=argparse.PARSER,
metavar="scriptfile [arg] ...")
# expect at least one positional, a py module
It is somewhat like subparsers, but without defined subparser choices. Or you could say that PARSER (A...) is to REMAINDER (...) as '+' is to '*'. It requires at least one argument. I could, just as well, have created two arguments, 'scriptfile' and 'args' (with '...').
I don't know if that is an argument for documenting it or not. |
|
Date |
User |
Action |
Args |
2013-04-17 04:14:36 | paul.j3 | set | recipients:
+ paul.j3, bethard, chris.jerdonek, docs@python, jeffknupp, Robert |
2013-04-17 04:14:36 | paul.j3 | set | messageid: <1366172076.48.0.619707550201.issue16988@psf.upfronthosting.co.za> |
2013-04-17 04:14:36 | paul.j3 | link | issue16988 messages |
2013-04-17 04:14:36 | paul.j3 | create | |
|