|
1 |
| -``docopt.cpp``: a C++11 port of docopt |
2 |
| -====================================================================== |
| 1 | +``docopt.cpp``: A C++11 port of the Python ``docopt`` |
| 2 | +===================================================== |
| 3 | +creates *beautiful* command-line interfaces |
| 4 | +------------------------------------------- |
3 | 5 |
|
4 | 6 | Isn't it awesome how ``getopt`` (and ``boost::program_options`` for you fancy
|
5 | 7 | folk!) generate help messages based on your code?! These timeless functions
|
@@ -71,16 +73,18 @@ original.
|
71 | 73 | This port is written in C++11 and also requires a good C++11 standard library
|
72 | 74 | (in particular, one with ``regex`` support). The following compilers should
|
73 | 75 | be able to handle this:
|
74 |
| -* clang 3.3 |
75 |
| -* gcc 4.9 (If someone can verify this, or provide patches, that would be great!) |
76 |
| -* Visual C++ 2013: will *not* compile this code. Hopefully next year. |
| 76 | + |
| 77 | +- clang 3.3 |
| 78 | +- gcc 4.9 (If someone can verify this, or provide patches, that would be great!) |
| 79 | +- Visual C++ 2013: will *not* compile this code. Hopefully next year. |
77 | 80 |
|
78 | 81 | This port is licensed under the MIT license, just like the original module.
|
79 | 82 | However, we are also dual-licensing this code under the Boost License, version 1.0,
|
80 | 83 | as this is a popular C++ license. The licenses are similar and you are free to
|
81 | 84 | use this code under the terms of either license.
|
82 | 85 |
|
83 | 86 | The differences from the Python port are:
|
| 87 | + |
84 | 88 | * the addition of a ``docopt_parse`` function, which does not terminate
|
85 | 89 | the program on error
|
86 | 90 | * a ``docopt::value`` type to hold the various value types that can be parsed.
|
|
96 | 100 |
|
97 | 101 | .. code:: c++
|
98 | 102 |
|
99 |
| - docopt::docopt(doc, argv, help=true, version="", options_first=false) |
| 103 | + docopt::docopt(doc, argv, help /* =true */, version /* ="" */, options_first /* =false */) |
100 | 104 |
|
101 | 105 | ``docopt`` takes 1 required and 4 optional arguments:
|
102 | 106 |
|
@@ -374,13 +378,15 @@ Compiling the code and running the tests
|
374 | 378 | The original Python module includes some language-agnostic unit tests,
|
375 | 379 | and these can be run with this port as well.
|
376 | 380 |
|
377 |
| -For example, with the clang compiler on OSX: |
| 381 | +For example, with the clang compiler on OSX:: |
| 382 | + |
378 | 383 | $ clang++ --std=c++11 --stdlib=libc++ docopt.cpp run_testcase.cpp -o run_testcase
|
379 | 384 | $ python run_tests.py
|
380 | 385 | PASS (175)
|
381 | 386 |
|
382 | 387 | You can also compile the example show at the start (also included as
|
383 |
| -example.cpp): |
| 388 | +example.cpp):: |
| 389 | + |
384 | 390 | $ clang++ clang++ --std=c++11 --stdlib=libc++ -I . docopt.cpp examples/naval_fate.cpp -o naval_fate
|
385 | 391 | $ ./naval_fate --help
|
386 | 392 | [ ... ]
|
|
0 commit comments