Skip to content

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

Open
mikebryant wants to merge 1 commit into
docopt:masterfrom
mikebryant:wip-3
Open

Use shlex to tokenize the input string. Fixes #3#6
mikebryant wants to merge 1 commit into
docopt:masterfrom
mikebryant:wip-3

Conversation

@mikebryant
Copy link
Copy Markdown

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
Copy Markdown
Member

mboersma commented Jun 9, 2016

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

Comment thread app.py

def run_docopt(doc, argv):
try:
argv = shlex.split(argv)
Copy link
Copy Markdown
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