shell: add select command
The "select" command has been implemented, which allows user to narrow down the command tree. This implementation differs from the "select" command available in the legacy shell. In a new implementation, if the selected command has a handler and if the user has not entered the registered subcommand, the shell will call the handler of selected command and pass the text as arguments. This may be useful, for example, if someone wants to use the shell as an interface to a modem that supports AT commands. Instead of each time you write e.g: at at+command1 at at+command2 at at+command3 user can execute following commands: select at at+command1 at+command2 at+command3 where: at - root command for passing at commands to the modem at+commandX - at command passed to the modem. Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
parent
fde86da6f5
commit
b633e431a4
8 changed files with 227 additions and 96 deletions
|
@ -555,6 +555,9 @@ struct shell_ctx {
|
|||
/*!< Currently executed command.*/
|
||||
struct shell_static_entry active_cmd;
|
||||
|
||||
/* New root command. If NULL shell uses default root commands. */
|
||||
const struct shell_static_entry *selected_cmd;
|
||||
|
||||
/*!< VT100 color and cursor position, terminal width.*/
|
||||
struct shell_vt100_ctx vt100_ctx;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue