Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 19098:f01ae031f84c stable
dispatch: add doctests for _earlygetopt
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Mon, 29 Apr 2013 14:14:41 -0700 |
parents | 12acbea17625 |
children | fc081623f4bd |
comparison
equal
deleted
inserted
replaced
19097:3f5e75c22585 | 19098:f01ae031f84c |
---|---|
483 def _earlygetopt(aliases, args): | 483 def _earlygetopt(aliases, args): |
484 """Return list of values for an option (or aliases). | 484 """Return list of values for an option (or aliases). |
485 | 485 |
486 The values are listed in the order they appear in args. | 486 The values are listed in the order they appear in args. |
487 The options and values are removed from args. | 487 The options and values are removed from args. |
488 | |
489 >>> args = ['x', '--cwd', 'foo', 'y'] | |
490 >>> _earlygetopt(['--cwd'], args), args | |
491 (['foo'], ['x', 'y']) | |
492 | |
493 >>> args = ['x', '-R', 'foo', 'y'] | |
494 >>> _earlygetopt(['-R'], args), args | |
495 (['foo'], ['x', 'y']) | |
496 | |
497 >>> args = ['x', '-Rbar', 'y'] | |
498 >>> _earlygetopt(['-R'], args), args | |
499 (['bar'], ['x', 'y']) | |
488 """ | 500 """ |
489 try: | 501 try: |
490 argcount = args.index("--") | 502 argcount = args.index("--") |
491 except ValueError: | 503 except ValueError: |
492 argcount = len(args) | 504 argcount = len(args) |