bzr command --
James Blackwell
jblack at merconline.com
Mon Aug 29 10:38:43 BST 2005
Here's my first patch for bzr. Its a simple one. I'm not sure I covered
all of the approprate test cases.
--
James Blackwell | Life is made of the stuff that hasn't killed
Tell someone a joke! | you yet. - yours truly
----------------------------------------------------------------------
GnuPG (ID 06357400) AAE4 8C76 58DA 5902 761D 247A 8A55 DA73 0635 7400
-------------- next part --------------
*** modified file 'bzrlib/commands.py'
--- bzrlib/commands.py
+++ bzrlib/commands.py
@@ -1727,6 +1727,8 @@
>>> parse_args('--help'.split())
([], {'help': True})
+ >>> parse_args('help -- --invalidcmd'.split())
+ (['help', '--invalidcmd'], {})
>>> parse_args('--version'.split())
([], {'version': True})
>>> parse_args('status --all'.split())
@@ -1745,15 +1747,18 @@
args = []
opts = {}
- # TODO: Maybe handle '--' to end options?
-
+ argsover = False
while argv:
a = argv.pop(0)
- if a[0] == '-':
+ if not argsover and a[0] == '-':
# option names must not be unicode
a = str(a)
optarg = None
if a[1] == '-':
+ if len(a) < 3 :
+ # We've received a standalone -- No more flags
+ argsover = True
+ continue
mutter(" got option %r" % a)
if '=' in a:
optname, optarg = a[2:].split('=', 1)
More information about the bazaar
mailing list