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

Use shlex to tokenize the input string. Fixes #3 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mikebryant
Copy link

Allow the use of quoted arguments, e.g.

Usage:
  test <arg1> <arg2>

with the input a "b c d"

If tokenization fails, fall back to the original behaviour

Allow the use of quoted arguments, e.g.
```
Usage:
  test <arg1> <arg2>
```
with the input `a "b c d"`

If tokenization fails, fall back to the original behaviour
@mboersma
Copy link
Member

mboersma commented Jun 9, 2016

This looks good to me. Anyone else in @docopt/docopt able to review this?

@@ -27,6 +27,10 @@


def run_docopt(doc, argv):
try:
argv = shlex.split(argv)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works but I think it's best to do the splitting elsewhere, so that run_docopt can accept a list of arguments, as is usual.

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

Successfully merging this pull request may close these issues.

3 participants