Boost logo

Boost Users :

Subject: [Boost-users] [ANN] CLI command line interface compiler for C++
From: Boris Kolpackov (boris_at_[hidden])
Date: 2009-10-29 03:49:18


Hi,

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:

http://www.codesynthesis.com/projects/cli/

Enjoy,
        Boris

-- 
Boris Kolpackov, Code Synthesis Tools  http://codesynthesis.com/~boris/blog
Open-source XML data binding for C++:  http://codesynthesis.com/products/xsd
XML data binding for embedded systems: http://codesynthesis.com/products/xsde

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net