Command Line Interface (CLI) definition language is a domain-specific language (DSL) for defining command line interfaces of C++ programs. It allows you to describe the options that your program supports, their types, default values, and documentation. For example:

include <string>;

class options
  std::string --name = "example";
  unsigned int --level | -l = 5;
  bool --help {"Print usage information and exit."};

CLI definitions are automatically translated to C++ classes using the CLI compiler. These classes implement parsing of the command line arguments and provide a convenient and type-safe interface for accessing the extracted data. In addition, the generated C++ code can print formatted program usage information. For example:

int main (int argc, char* argv[])
  options o (argc, argv);

  if ( ())
    options::print_usage (cerr);

  if (o.level () > 4)
    cerr << "name is " << () << endl;

The CLI compiler can also generate the command line interface documentation in the HTML and man page formats. For an example of the automatically generated documentation, see the CLI Compiler Command Line Manual.

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 quick introduction to CLI see the Hello World Example in the CLI Language Getting Started Guide.



The CLI compiler is free, open-source software; you can use, distribute, and/or modify it under the terms of the MIT License.


CLI Language Getting Started Guide An introduction to the CLI language and its mapping to C++. Also available in PDF and PostScript.
CLI Compiler Command Line Manual The CLI compiler command line interface documentation (man pages).
Design and Development of CLI A series of ongoing blog posts about the design and development of the CLI language and compiler.


The CLI compiler is distributed in source code and includes makefiles and VC++ project files. Follow the instructions in the accompanying README file to build the CLI compiler and examples for your platform. The source code distributions for the current stable release of CLI, including dependencies, are:

For older versions and other distributions see the CLI download directory. The development version of CLI is available from the source code repository (git).


We provide free, best-effort technical support for CLI via the cli-users mailing list. Simply send an email to this mailing list with the description of a bug or a problem that you encountered. Please follow the Posting Guidelines to receive a prompt reply.