~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-08-30 03:14:42 UTC
  • Revision ID: mbp@sourcefrog.net-20050830031442-445c7b00640b967c
- accept -- to terminate options
  (patch from jblack)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1714
1714
 
1715
1715
    >>> parse_args('--help'.split())
1716
1716
    ([], {'help': True})
 
1717
    >>> parse_args('help -- --invalidcmd'.split())
 
1718
    (['help', '--invalidcmd'], {})
1717
1719
    >>> parse_args('--version'.split())
1718
1720
    ([], {'version': True})
1719
1721
    >>> parse_args('status --all'.split())
1732
1734
    args = []
1733
1735
    opts = {}
1734
1736
 
1735
 
    # TODO: Maybe handle '--' to end options?
1736
 
 
 
1737
    argsover = False
1737
1738
    while argv:
1738
1739
        a = argv.pop(0)
1739
 
        if a[0] == '-':
 
1740
        if not argsover and a[0] == '-':
1740
1741
            # option names must not be unicode
1741
1742
            a = str(a)
1742
1743
            optarg = None
1743
1744
            if a[1] == '-':
 
1745
                if a == '--':
 
1746
                    # We've received a standalone -- No more flags
 
1747
                    argsover = True
 
1748
                    continue
1744
1749
                mutter("  got option %r" % a)
1745
1750
                if '=' in a:
1746
1751
                    optname, optarg = a[2:].split('=', 1)