English | 中文
Library of Open Command Line Interface - is a Linux C library / framework for quickly building Cisco style command line programs. The example directory includes a "democli" program, which demonstates how to use Libocli to implement the "enable", "configure terminal", "interface", and “show" commands. Libocli Quick Start Guide describes the keys steps of how to build a simple "ping" command, including symbol definition, syntax registration, and callback implementation. For more details please refer to the Libocli API Manual.
Below are running effect of the "democli" program:
- Keyword auto completion by TAB, '?' to get lexical help, and "man" to get syntax help:
- “enable", "conf t" to change privilege VIEWs, and "no route", "show run" commands:
Libocli depends on GNU readline and pcre libraries. Please make sure that both readline and pcre development packages are present in your system before installation, then make as below:
make
make install
make demo
After making processes, libocli.so and libocli.a will be installed into /usr/local/lib, and library headers will be installed into /usr/local/include/ocli . The "make demo" generates an executable "democli" used in above GIFs in the working directory.