Hacker Newsnew | past | comments | ask | show | jobs | submit | more halst's commentslogin

You can just change the second line to:

    naval_fate ship move <name> <x> <y> [--speed=<kn>]
to eliminate all the problems you named. Those problems are about specific interface, not docopt.


As I said I was nitpicking. :)


But I must warn you: Ruby port (as of now) implements only a small subset of docopt language, but we're working on it.


I'm back from holiday now and should have some time to work on this - Alex


Thanks a lot for the link. Your suggestion will probably make into next version of docopt.


Getopt::Euclid from CPAN is also very similar.


docopt will maybe borrow a few ideas from dreamopts.js :-) Would you like to join forces on [docopt.coffee](https://github.com/docopt/docopt.coffee)?


When the DSL (http://docopt.org/) was designed, the main goal was just to formalise that pattern-language used for decades in man pages and `--help` screens. So variations that are conventional (such as `UPPER-CASE` for arguments or `<angular-brackets>` for arguments) are supported.


I think Clap is good. But you can't beat the readability and succinctness of a DSL (docopt).


Right now we have two full-blown working implementations: - Python - CoffeeScript

We have just started to port to Ruby and Lua. All ports live under `docopt` organization on GitHub: https://github.com/docopt

You are very welcome to help us out with Ruby, Lua, and your favorite language :-).


BTW, about bad pitch: maybe :-)

I wanted to improve on presentation, since my last post: http://news.ycombinator.com/submitted?id=halst


For me, your new presentation worked brilliantly. The short while it took me to get what was going on, was exactly what caused me to keep reading. Granted, it is a bit of a bait and switch, but a pleasant one.

Great idea, great presentation!


I too think the pitch is brilliant - specially when you think about the target audience - folks who get turned on by the word "Challenge", er developers, and most of them must have felt the need for something like this at some point of their life("Some day I'll have to write clean & DRY way ...").

Only thing different might be instead of giving the solution on that page itself - a hyperlink to the solution which takes you to docopt.org landing page


I agree. I thought, interesting challenge, although not interesting enough for me to actually try it. I wonder if he has any example solutions that I could look through. Huh? Ooooh.

If I had just seen it presented straight out as, "Parse arguments based on docstrings," I doubt it would have been nearly as memorable.


docopt is even more terse than 1 line per argument/option/command.

Take an example:

    Usage: quick_example.py tcp <host> <port> [--timeout=<seconds>]
           quick_example.py serial <port> [--baud=9600] [--timeout=<seconds>]
           quick_example.py -h | --help | --version

2 commands, 3 arguments, 5 options: in only 3 lines of DSL.

Take a look at more examples: https://github.com/docopt/docopt/tree/master/examples


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: