Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[ANN] CLI command line interface compiler for C++

1 view
Skip to first unread message

Boris Kolpackov

unread,
Oct 29, 2009, 4:07:37 AM10/29/09
to
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

cch

unread,
Nov 5, 2009, 9:46:23 PM11/5/09
to
于 Thu, 29 Oct 2009 03:07:37 -0500,Boris Kolpackov写到:


cool!! Will try it later.


0 new messages