This module allows to create and handle a simple command line interface (CLI) with a user-defined command set. You can use it in examples where more than button/LED user interaction is required. This module can be considered a simplified Unix-like command line interface with these features:
list
, clear
, and history
commandsThe module can be connected to any transport. At this point, the following transport layers are implemented:
Use the NRF_CLI_DEF macro to create an instance of the CLI. The following code shows a simple use case of this library:
Every user-defined command can have short options and long options:
x
is a letter.xyz
is a word (without whitespaces).Every option can be followed by an argument. Macro NRF_CLI_OPT defines the options:
Parsing of options works similarly to the getopt_long library:
The following code shows how command options should be processed:
For API documentation of this library, refer to Command Line Interface.
For a usage example, refer to Command Line Interface (CLI) Example.