1
- ``docopt.cpp ``: A C++11 port of the Python `` docopt ``
2
- =====================================================
3
- creates *beautiful * command-line interfaces
4
- -------------------------------------------
1
+ ``docopt.cpp ``: A C++11 Port
2
+ ============================
3
+ doctopt creates *beautiful * command-line interfaces
4
+ ---------------------------------------------------
5
5
6
6
Isn't it awesome how ``getopt `` (and ``boost::program_options `` for you fancy
7
7
folk!) generate help messages based on your code?! These timeless functions
@@ -64,7 +64,7 @@ that. The basic idea is that *a good help message has all necessary
64
64
information in it to make a parser *.
65
65
66
66
C++11 port details
67
- ======================================================================
67
+ ---------------------------------------------------
68
68
69
69
This is a port of the ``docopt.py `` module (https://github.com/docopt/docopt),
70
70
and we have tried to maintain full feature parity (and code structure) as the
@@ -85,18 +85,18 @@ use this code under the terms of either license.
85
85
86
86
The differences from the Python port are:
87
87
88
- * the addition of a ``docopt_parse `` function, which does not terminate
89
- the program on error
90
- * a ``docopt::value `` type to hold the various value types that can be parsed.
91
- We considered using boost::variant, but it seems better to have no external
92
- dependencies (beyond a good STL).
93
- * because C++ is statically-typed and Python is not, we had to make some
94
- changes to the interfaces of the internal parse tree types.
95
- * because ``std::regex `` does not have an equivalent to Python's regex.split,
96
- some of the regex's had to be restructured and additional loops used.
88
+ * the addition of a ``docopt_parse `` function, which does not terminate
89
+ the program on error
90
+ * a ``docopt::value `` type to hold the various value types that can be parsed.
91
+ We considered using boost::variant, but it seems better to have no external
92
+ dependencies (beyond a good STL).
93
+ * because C++ is statically-typed and Python is not, we had to make some
94
+ changes to the interfaces of the internal parse tree types.
95
+ * because ``std::regex `` does not have an equivalent to Python's regex.split,
96
+ some of the regex's had to be restructured and additional loops used.
97
97
98
98
API
99
- ======================================================================
99
+ ---------------------------------------------------
100
100
101
101
.. code :: c++
102
102
@@ -174,7 +174,7 @@ the return dictionary will be:
174
174
" <y>" : " 150" }
175
175
176
176
Help message format
177
- ======================================================================
177
+ ---------------------------------------------------
178
178
179
179
Help message consists of 2 parts:
180
180
@@ -373,7 +373,7 @@ we implemented a subset of git command-line interface as an example:
373
373
`examples/git
374
374
<https://github.com/docopt/docopt/tree/master/examples/git> `_
375
375
376
- Compiling the code and running the tests
376
+ Compiling the example / Running the tests
377
377
----------------------------------------------------------------------
378
378
The original Python module includes some language-agnostic unit tests,
379
379
and these can be run with this port as well.
@@ -394,7 +394,7 @@ example.cpp)::
394
394
[ ... ]
395
395
396
396
Development
397
- ======================================================================
397
+ ---------------------------------------------------
398
398
399
399
Comments and suggestions are *very * welcome! If you find issues, please
400
400
file them and help improve our code!
@@ -405,7 +405,7 @@ we might want to first negotiate these changes into the Python code first.
405
405
However, bring it up! Let's hear it!
406
406
407
407
Changelog
408
- ======================================================================
408
+ ---------------------------------------------------
409
409
410
410
**docopt ** follows `semantic versioning <http://semver.org >`_. The
411
411
first release with stable API will be 1.0.0 (soon).
0 commit comments