Commit d24a59267caf257724e5a9ed34b122537bc25f75

Authored by Henry Fredrick Schreiner
2 parents 3b04cd62 100db357

Merge branch 'master' into parse-order

README.md
@@ -31,15 +31,25 @@ An acceptable CLI parser library should be all of the following: @@ -31,15 +31,25 @@ An acceptable CLI parser library should be all of the following:
31 * Work with standard types, simple custom types, and extendible to exotic types. 31 * Work with standard types, simple custom types, and extendible to exotic types.
32 * Permissively licenced. 32 * Permissively licenced.
33 33
34 -The major CLI parsers for C++ include:  
35 -  
36 -* [Boost Program Options]: A great library if you already depend on Boost, but its pre-C++11 syntax is really odd and setting up the correct call in the main function is poorly documented (and is nearly a page of code). A simple wrapper for the Boost library was originally developed, but was discarded as CLI11 became more powerful. The idea of capturing a value and setting it originated with Boost PO.  
37 -* [The Lean Mean C++ Option Parser]: One header file is great, but the syntax is atrocious, in my opinion. It was quite impractical to wrap the syntax or to use in a complex project. It seems to handle standard parsing quite well.  
38 -* [TCLAP]: The not-quite-standard command line parsing causes common shortcuts to fail. It also seems to be poorly supported, with only minimal bugfixes accepted. Header only, but in quite a few files. Has not managed to get enough support to move to GitHub yet. No subcommands. Produces wrapped values.  
39 -* [Cxxopts]: C++11, single file, and nice CMake support, but requires regex, therefore GCC 4.8 (CentOS 7 default) does not work. Syntax closely based on Boost PO, so not ideal but familiar.  
40 -* [DocOpt]: Completely different approach to program options in C++11, you write the docs and the interface is generated. Too fragile and specialized.  
41 -* [GFlags]: The Google Commandline Flags library. Uses macros heavily, and is limited in scope, missing things like subcommands. It provides a simple syntax and supports config files/env vars.  
42 -* [GetOpt]: Very limited C solution with long, convoluted syntax. Does not support much of anything, like help generation. Always available on UNIX, though (but in different flavors). 34 +The major CLI parsers for C++ include (with my biased opinions):
  35 +
  36 +| Library | My biased opinion |
  37 +|---------|-------------------|
  38 +| [Boost Program Options] | A great library if you already depend on Boost, but its pre-C++11 syntax is really odd and setting up the correct call in the main function is poorly documented (and is nearly a page of code). A simple wrapper for the Boost library was originally developed, but was discarded as CLI11 became more powerful. The idea of capturing a value and setting it originated with Boost PO. |
  39 +| [The Lean Mean C++ Option Parser] | One header file is great, but the syntax is atrocious, in my opinion. It was quite impractical to wrap the syntax or to use in a complex project. It seems to handle standard parsing quite well. |
  40 +| [TCLAP] | The not-quite-standard command line parsing causes common shortcuts to fail. It also seems to be poorly supported, with only minimal bugfixes accepted. Header only, but in quite a few files. Has not managed to get enough support to move to GitHub yet. No subcommands. Produces wrapped values. |
  41 +| [Cxxopts] | C++11, single file, and nice CMake support, but requires regex, therefore GCC 4.8 (CentOS 7 default) does not work. Syntax closely based on Boost PO, so not ideal but familiar. |
  42 +| [DocOpt] | Completely different approach to program options in C++11, you write the docs and the interface is generated. Too fragile and specialized. |
  43 +
  44 +After I wrote this, I also found the following libraries:
  45 +
  46 +| Library | My biased opinion |
  47 +|---------|-------------------|
  48 +| [GFlags] | The Google Commandline Flags library. Uses macros heavily, and is limited in scope, missing things like subcommands. It provides a simple syntax and supports config files/env vars. |
  49 +| [GetOpt] | Very limited C solution with long, convoluted syntax. Does not support much of anything, like help generation. Always available on UNIX, though (but in different flavors). |
  50 +| [ProgramOptions.hxx] | Intresting library, less powerful and no subcommands. |
  51 +| [Args] | Also interesting, and supports subcommands. I like the optional-like design, but CLI11 is cleaner and provides direct value access, and is less verbose. |
  52 +| [Argument Aggregator] | I'm a big fan of the [fmt] library, and the try-catch statement looks familiar. :thumbsup: Doesn't seem to support subcommands. |
43 53
44 None of these libraries fulfill all the above requirements. As you probably have already guessed, CLI11 does. 54 None of these libraries fulfill all the above requirements. As you probably have already guessed, CLI11 does.
45 So, this library was designed to provide a great syntax, good compiler compatibility, and minimal installation fuss. 55 So, this library was designed to provide a great syntax, good compiler compatibility, and minimal installation fuss.
@@ -306,4 +316,8 @@ CLI11 was developed at the [University of Cincinnati] to support of the [GooFit] @@ -306,4 +316,8 @@ CLI11 was developed at the [University of Cincinnati] to support of the [GooFit]
306 [DIANA/HEP]: http://diana-hep.org 316 [DIANA/HEP]: http://diana-hep.org
307 [NSF Award 1414736]: https://nsf.gov/awardsearch/showAward?AWD_ID=1414736 317 [NSF Award 1414736]: https://nsf.gov/awardsearch/showAward?AWD_ID=1414736
308 [University of Cincinnati]: http://www.uc.edu 318 [University of Cincinnati]: http://www.uc.edu
309 -[GitBook]: https://henryiii.gitbooks.io/cli11/content 319 +[GitBook]: https://henryiii.gitbooks.io/cli11/content
  320 +[ProgramOptions.hxx]: https://github.com/Fytch/ProgramOptions.hxx
  321 +[Argument Aggregator]: https://github.com/vietjtnguyen/argagg
  322 +[Args]: https://github.com/Taywee/args
  323 +[fmt]: https://github.com/fmtlib/fmt
examples/CMakeLists.txt
@@ -14,6 +14,6 @@ function(add_cli_exe T) @@ -14,6 +14,6 @@ function(add_cli_exe T)
14 endif() 14 endif()
15 endfunction() 15 endfunction()
16 16
17 -add_cli_exe(try try.cpp)  
18 -add_cli_exe(try1 try1.cpp)  
19 -add_cli_exe(try2 try2.cpp) 17 +add_cli_exe(simple simple.cpp)
  18 +add_cli_exe(subcommands subcommands.cpp)
  19 +add_cli_exe(groups groups.cpp)
examples/try2.cpp renamed to examples/groups.cpp
examples/try.cpp renamed to examples/simple.cpp
examples/try1.cpp renamed to examples/subcommands.cpp