CLIfford
A simple and highly customisable command line interface for C++ applications.

At a glance
- C++
Tags
A generic command line interface library for C++ applications: you inherit from a base class, register your commands, and get a prompt with a history, a help system and a splash screen.
It is an archived project, originally built during engineering school at ENSEEIHT. No further development is planned, and it stays available for reference.
Features
- Custom commands, arguments and options.
- An integrated help system and splash screen.
- Colour support, with ready-made helpers such as RED, GREEN and CYAN.
- A command history.
Using it
A command line is a class that inherits from the library's CLI class and adds commands in its constructor, each with a name, a description and a function that receives its arguments:
class MyCLI : public core::CLI {
public:
MyCLI() {
_addCommand("greet", "Greets a user by name",
[](core::CLI* cli, std::vector<std::string> args) {
if (!args.empty()) {
std::cout << GREEN("Hello, " << args[0] << "!\n");
} else {
std::cout << YELLOW("Hello, stranger!\n");
}
});
}
};It is built with CMake and needs a C++20 compiler. A demo program is included, and the library can be pulled into another CMake project with FetchContent.

