smack::cli user's guide - smacklib/dev_smack_cpp GitHub Wiki
smack::cli
contains support for implementing command line applications.
Overview
The concept is to map a command line to an operation implemented in C++, hiding and simplifying as much as possible the needed implementation details from the coder. This includes:
- Subcommands are supported and mapped to operations, either to free functions or to instance operations of an object.
- Parameter type conversion is performed automatically and results in an understandable error message if an error occurs.
- The C++ primitive types are mapped out-of-the-box, custom type conversions can be easily added.
- Error handling is based on C++ exceptions and results in end-user compatible messages.
- A command help page is automatically printed if a command is called without a parameter or with a single
--help
as a parameter.
Technical
smack::cli
's basic concept is to make functions implemented in
C++ callable from the command line as commands with minimial
efforts for the coder. That is, parameter conversion is
handled automatically and a nice help page is printed if
the cli is executed without any arguments.
Example
See the source code example