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

Update testcases.docopt #201

Closed
wants to merge 1 commit into from
Closed

Conversation

BurntSushi
Copy link
Member

I'm not 100% sure that all my changes are correct (especially the first few to "user-error", but I couldn't find anything in the Docopt README that said names can be accessed via prefix).

Would you be open to adding tests that require more sophisticated pattern matching? e.g., cp FILE... DIR. I have it working in my Rust port along with all tests passing.

@keleshev
Copy link
Member

keleshev commented Jul 3, 2014

Accessing --version via --ver is an unfortunate feature. We'll get rid of it some time, but it's a breaking change. So I will not pull these changes to tests, because this would break the build.

I'm not fluent in Rust, so could you describe briefly your implementation strategy for cp FILE... DIR?
Does it handle cases like:

prog <x> [<y>] <z>
prog <x> <y>... <z>
prog <x>... command <y>...

@keleshev
Copy link
Member

keleshev commented Jul 3, 2014

Also, our current Rust port is outdated. Do you want to replace it?

@BurntSushi
Copy link
Member Author

Does it handle cases like:

Yes. Although you last case caught a bug (just fixed it).

I'm not fluent in Rust, so could you describe briefly your implementation strategy for cp FILE... DIR?

The problem of matching a pattern to an argv is similar to an already known problem: regular expression matching. So I just wrote a pretty naive backtracking matcher. A repeating argument consumes as little as possible for the entire pattern to match. You can see the code that handles a repeating pattern.

Think of <x>... cmd <y>... as (.+?)cmd(.+?)$.

@BurntSushi
Copy link
Member Author

Also, our current Rust port is outdated. Do you want to replace it?

Sure! But I do have some ideas on how best to expose a convenient API. Could you check out the macro ideas section in my README and make sure you're OK with that? (The library will still have a regular dictionary-like API---as it does now---but I don't intend for it to be the common use case. Still kind of thinking about it.)

@keleshev
Copy link
Member

keleshev commented Aug 8, 2014

This change will be introduced eventually, but not now.

@keleshev keleshev closed this Aug 8, 2014
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.

None yet

2 participants