
I am pleased to announce the first public release of CLI.
CLI is an open-source (MIT license), cross-platform command line interface compiler for C++. It allows you to specify the options that your program supports, their types, and default values. For example:
include <string>;
class options { bool --help; std::string --name = "example"; unsigned int --level | -l = 5; };
This specification can then be automatically translated to C++ classes that implement parsing of the command line arguments and provide a convenient and type-safe interface for accessing the extracted data. For example:
#include <string>
class options { public: options (int argc, char** argv); options (int argc, char** argv, int& end);
bool help () const; const std::string& name () const; unsigned int level () const;
... };
int main (int argc, char* argv[]) { options o (argc, argv);
if (o.help ()) print_usage ();
if (o.level () > 4) cerr << "name is " << o.name () << endl; ... }
It is easy to start using CLI in your application since there are no external dependencies. You can compile your command line interface to C++ and simply add the generated files to your project's source code.
For a five minute introduction to CLI, see the "Hello World" example in the CLI Getting Started Guide:
http://www.codesynthesis.com/projects/cli/doc/guide/#2
More information, documentation, and source code distributions are available from the project's web page:
What's the benefit of your solution if compared to Boost.ProgramOptions? Does it generate code based on the Boost.ProgramOptions API? Regards Hartmut ------------------- Meet me at BoostCon http://boostcon.com