Boost logo

Boost :

Subject: [boost] [ANN] CLI command line interface compiler for C++
From: Boris Kolpackov (boris_at_[hidden])
Date: 2009-10-29 03:43:57


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
  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 ( ())
    print_usage ();

  if (o.level () > 4)
    cerr << "name is " << () << 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:

More information, documentation, and source code distributions are
available from the project's web page:


Boris Kolpackov, Code Synthesis Tools
Open-source XML data binding for C++:
XML data binding for embedded systems:

Boost list run by bdawes at, gregod at, cpdaniel at, john at