Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docopt 0.6 fails to handle very simple usage message with two subcommands #85

Closed
schmir opened this issue Feb 1, 2013 · 1 comment
Closed

Comments

@schmir
Copy link
Contributor

schmir commented Feb 1, 2013

There's a rather serious regression in docopt 0.6.

The following program fails to parse a simple "fs fail --loglevel
5". Instead it prints the usage message:

#! /usr/bin/env python

"""
Usage:
  fs good [options]
  fs fail [options]

Options:
      --loglevel=<level>       loglevel
"""

import docopt
print docopt.docopt(__doc__)

i.e. with docopt 0.6 I get

[dev]  ~/ % ./fs good --loglevel 5
{'--loglevel': '5',
 'fail': False,
 'good': True}
[dev]  ~/ % ./fs fail --loglevel 5
Usage:
  fs good [options]
  fs fail [options]

Without the --loglevel parameter it's working:

[dev]  ~/ % ./fs fail
{'--loglevel': None,
 'fail': True,
 'good': False}

with 0.5 I get the expected results:

[dev]  ~/ % ./fs good --loglevel 5
{'--loglevel': '5',
 'fail': False,
 'good': True}
[dev]  ~/ % ./fs fail --loglevel 5
{'--loglevel': '5',
 'fail': True,
 'good': False}
@keleshev
Copy link
Member

keleshev commented Feb 1, 2013

This is now on PyPI: http://pypi.python.org/pypi/docopt

@keleshev keleshev closed this as completed Feb 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants