shell: creating new module for help functionality

1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2018-11-26 17:09:56 +01:00 committed by Carles Cufí
commit 3064ca4f2f
27 changed files with 686 additions and 956 deletions

View file

@ -8,6 +8,7 @@
#include <zephyr.h>
#include <shell/shell.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -42,9 +43,29 @@ char shell_make_argv(size_t *argc, char **argv, char *cmd, uint8_t max_argc);
*/
void shell_pattern_remove(char *buff, u16_t *buff_len, const char *pattern);
/* @brief Function shall be used to search commands.
*
* It moves the pointer entry to command of static command structure. If the
* command cannot be found, the function will set entry to NULL.
*
* @param command Pointer to command which will be processed (no matter
* the root command).
* @param lvl Level of the requested command.
* @param idx Index of the requested command.
* @param entry Pointer which points to subcommand[idx] after function
* execution.
* @param st_entry Pointer to the structure where dynamic entry data can be
* stored.
*/
void shell_cmd_get(const struct shell_cmd_entry *command, size_t lvl,
size_t idx, const struct shell_static_entry **entry,
struct shell_static_entry *d_entry);
int shell_command_add(char *buff, u16_t *buff_len,
const char *new_cmd, const char *pattern);
const struct shell_cmd_entry *root_cmd_find(const char *syntax);
void shell_spaces_trim(char *str);
/** @brief Remove white chars from beginning and end of command buffer.
@ -52,6 +73,11 @@ void shell_spaces_trim(char *str);
*/
void shell_buffer_trim(char *buff, u16_t *buff_len);
static inline void transport_buffer_flush(const struct shell *shell)
{
shell_fprintf_buffer_flush(shell->fprintf_ctx);
}
#ifdef __cplusplus
}
#endif