123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #ifndef SHELL_UTILS_H__
- #define SHELL_UTILS_H__
- #include <zephyr.h>
- #include <shell/shell.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define SHELL_MSG_SPECIFY_SUBCOMMAND "Please specify a subcommand.\n"
- int32_t z_row_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
- uint16_t offset1,
- uint16_t offset2);
- int32_t z_column_span_with_buffer_offsets_get(struct shell_multiline_cons *cons,
- uint16_t offset1,
- uint16_t offset2);
- void z_shell_multiline_data_calc(struct shell_multiline_cons *cons,
- uint16_t buff_pos, uint16_t buff_len);
- static inline uint16_t z_shell_strlen(const char *str)
- {
- return str == NULL ? 0U : (uint16_t)strlen(str);
- }
- char z_shell_make_argv(size_t *argc, const char **argv,
- char *cmd, uint8_t max_argc);
- void z_shell_pattern_remove(char *buff, uint16_t *buff_len,
- const char *pattern);
- const struct shell_static_entry *z_shell_cmd_get(
- const struct shell_static_entry *parent,
- size_t idx,
- struct shell_static_entry *dloc);
- const struct shell_static_entry *z_shell_find_cmd(
- const struct shell_static_entry *parent,
- const char *cmd_str,
- struct shell_static_entry *dloc);
- const struct shell_static_entry *z_shell_get_last_command(
- const struct shell_static_entry *entry,
- size_t argc,
- const char *argv[],
- size_t *match_arg,
- struct shell_static_entry *dloc,
- bool only_static);
- void z_shell_spaces_trim(char *str);
- void z_shell_cmd_trim(const struct shell *shell);
- const struct shell_static_entry *root_cmd_find(const char *syntax);
- static inline void z_transport_buffer_flush(const struct shell *shell)
- {
- z_shell_fprintf_buffer_flush(shell->fprintf_ctx);
- }
- static inline bool z_shell_in_select_mode(const struct shell *shell)
- {
- return shell->ctx->selected_cmd == NULL ? false : true;
- }
- #ifdef __cplusplus
- }
- #endif
- #endif
|