CLIgen

CLIgen builds interactive syntax-driven command-line interfaces in C from a high-level syntax specification. Interactive CLIs are often used in communication devices such as routers and switches. However, any device with a textual, syntax-driven, command-based interface can use CLIgen to make CLI programming easy.

CLIgen takes a syntax specification as input, generates a tree representation of the syntax, and provides an interactive command-line tool with completion, help, modes, etc. CLIgen is built to be efficient, and handles millions of syntax rules with fast feedback.

A designer formulates the command-line syntax and writes callback functions in C to implement the semantics of the commands.

A good starting point is the hello world example with a simple syntax specification (”hello world”) and a callback with a print statement, which produces the following CLI executable:

  > ./cligen_hello
  hello> hello world
  Hello World!
  hello>

There is a cligen tutorial on how to define a syntax and how to program.

There is also a cligen presentation from the Bifrost annual workshop in November 2012.

CLIgen is used in many research prototypes and commercial products. Products include Netclean's whitebox, and Prosilient's PTAnalyzer.

Download CLIgen from Github. Latest CLIgen version 3.4 is released in July 2013.

CLIgen is available as GPL or commercial license.


Contact author at olof hagsand.se.