1 /* 2 * Copyright (c) 2018 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef SHELL_SHELL_WILDCARDS_H__ 8 #define SHELL_SHELL_WILDCARDS_H__ 9 10 #include <zephyr/shell/shell.h> 11 12 enum shell_wildcard_status { 13 SHELL_WILDCARD_CMD_ADDED, 14 SHELL_WILDCARD_CMD_MISSING_SPACE, 15 SHELL_WILDCARD_CMD_NO_MATCH_FOUND, /* no matching command */ 16 SHELL_WILDCARD_NOT_FOUND /* wildcard character not found */ 17 }; 18 19 /* Function initializing wildcard expansion procedure. 20 * 21 * @param[in] shell Pointer to the shell instance. 22 */ 23 void z_shell_wildcard_prepare(const struct shell *sh); 24 25 /* Function returns true if string contains wildcard character: '?' or '*' 26 * 27 * @param[in] str Pointer to string. 28 * 29 * @retval true wildcard character found 30 * @retval false wildcard character not found 31 */ 32 bool z_shell_has_wildcard(const char *str); 33 34 /* Function expands wildcards in the shell temporary buffer 35 * 36 * @brief Function evaluates one command. If command contains wildcard patter, 37 * function will expand this command with all commands matching wildcard 38 * pattern. 39 * 40 * Function will print a help string with: the currently entered command, its 41 * options,and subcommands (if they exist). 42 * 43 * @param[in] shell Pointer to the shell instance. 44 * @param[in] cmd Pointer to command which will be processed. 45 * @param[in] pattern Pointer to wildcard pattern. 46 */ 47 enum shell_wildcard_status z_shell_wildcard_process(const struct shell *sh, 48 const struct shell_static_entry *cmd, 49 const char *pattern); 50 51 /* Function finalizing wildcard expansion procedure. 52 * 53 * @param[in] shell Pointer to the shell instance. 54 */ 55 void z_shell_wildcard_finalize(const struct shell *sh); 56 57 58 #endif /* SHELL_SHELL_WILDCARDS_H__ */ 59