8000 README: some updates in formatting and text · patrickjwhite/docopt.cpp@f70864c · GitHub
[go: up one dir, main page]

Skip to content

Commit f70864c

Browse files
committed
README: some updates in formatting and text
1 parent 1f87fee commit f70864c

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

README.rst

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
``docopt.cpp``: a C++11 port for docopt-py
1+
``docopt.cpp``: a C++11 port of docopt
22
======================================================================
33

44
Isn't it awesome how ``getopt`` (and ``boost::program_options`` for you fancy
@@ -40,10 +40,11 @@ and instead can write only the help message--*the way you want it*.
4040

4141
int main(int argc, const char** argv)
4242
{
43-
std::map<std::string, docopt::value> args = docopt::docopt(USAGE,
44-
{ argv + 1, argv + argc },
45-
true, // show help if requested
46-
"Naval Fate 2.0"); // version string
43+
std::map<std::string, docopt::value> args
44+
= docopt::docopt(USAGE,
45+
{ argv + 1, argv + argc },
46+
true, // show help if requested
47+
"Naval Fate 2.0"); // version string
4748

4849
for(auto const& arg : args) {
4950
std::cout << arg.first << arg.second << std::endl;
@@ -70,9 +71,9 @@ original.
7071
This port is written in C++11 and also requires a good C++11 standard library
7172
(in particular, one with ``regex`` support). The following compilers should
7273
be able to handle this:
73-
* clang 3.3
74-
* gcc 4.9 (If someone can verify this, or provide patches, that would be great!)
75-
* Visual C++ 2013 will almost certainly *not* compile this code. Hopefully next year.
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.
7677

7778
This port is licensed under the MIT license, just like the original module.
7879
However, we are also dual-licensing this code under the Boost License, version 1.0,
@@ -153,7 +154,7 @@ arguments and commands as keys, spelled exactly like in your help message.
153154
Long versions of options are given priority. For example, if you invoke the
154155
top example as::
155156

156-
naval_fate.py ship Guardian move 100 150 --speed=15
157+
naval_fate ship Guardian move 100 150 --speed=15
157158

158159
the return dictionary will be:
159160

@@ -196,7 +197,7 @@ Minimum example:
196197

197198
.. code:: python
198199
199-
"""Usage: my_program.py
200+
"""Usage: my_program
200201
201202
"""
202203
@@ -206,8 +207,8 @@ exclusive patterns:
206207

207208
.. code:: python
208209
209-
"""Usage: my_program.py FILE
210-
my_program.py COUNT FILE
210+
"""Usage: my_program FILE
211+
my_program COUNT FILE
211212
212213
"""
213214
@@ -356,24 +357,6 @@ source if in doubt.
356357
There are also very intersting applications and ideas at that page.
357358
Check out the sister project for more information!
358359

359-
Compiling the code and running the tests
360-
----------------------------------------------------------------------
361-
The original Python module includes some language-agnostic unit tests,
362-
and these can be run with this port as well.
363-
364-
For example, with the clang compiler on OSX:
365-
$ clang++ --std=c++11 --stdlib=libc++ docopt.cpp run_testcase.cpp -o run_testcase
366-
$ python run_tests.py
367-
PASS (175)
368-
369-
You can also compile the example show at the start (also included as
370-
example.cpp):
371-
$ clang++ clang++ --std=c++11 --stdlib=libc++ -I . docopt.cpp examples/naval_fate.cpp -o naval_fate
372-
$ ./naval_fate --help
373-
[ ... ]
374-
$ ./naval_fate ship Guardian move 100 150 --speed=15
375-
[ ... ]
376-
377360
Subparsers, multi-level help and *huge* applications (like git)
378361
----------------------------------------------------------------------
379362

@@ -386,6 +369,24 @@ we implemented a subset of git command-line interface as an example:
386369
`examples/git
387370
<https://github.com/docopt/docopt/tree/master/examples/git>`_
388371

372+
Compiling the code and running the tests
373+
----------------------------------------------------------------------
374+
The original Python module includes some language-agnostic unit tests,
375+
and these can be run with this port as well.
376+
377+
For example, with the clang compiler on OSX:
378+
$ clang++ --std=c++11 --stdlib=libc++ docopt.cpp run_testcase.cpp -o run_testcase
379+
$ python run_tests.py
380+
PASS (175)
381+
382+
You can also compile the example show at the start (also included as
383+
example.cpp):
384+
$ clang++ clang++ --std=c++11 --stdlib=libc++ -I . docopt.cpp examples/naval_fate.cpp -o naval_fate
385+
$ ./naval_fate --help
386+
[ ... ]
387+
$ ./naval_fate ship Guardian move 100 150 --speed=15
388+
[ ... ]
389+
389390
Development
390391
======================================================================
391392

0 commit comments

Comments
 (0)
0