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) |