shell: remove "options" concept
Removing help "options" from shell API.
Currently SHELL_OPT macro is not used by users. What is more
commit: a89690d10f
ignores possible options created in
command handler by the user. As a result they are not printed
in help message.
Second, currntly implemented "options" in command handlers options are
implemented without SHELL_OPT macro.
And last but not least this change will allow to implement
help handler in a way that user will not need to think about calling
functions printing help in a command handler.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
parent
c67bb6d440
commit
5451ff2848
29 changed files with 168 additions and 254 deletions
|
@ -289,7 +289,7 @@ checks for valid arguments count.
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell) {
|
if (shell_help_requested(shell) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
} else {
|
} else {
|
||||||
shell_fprintf(shell, SHELL_NORMAL,
|
shell_fprintf(shell, SHELL_NORMAL,
|
||||||
"Command called with no -h or --help option."
|
"Command called with no -h or --help option."
|
||||||
|
|
|
@ -231,12 +231,12 @@ static int cmd_flash(const struct shell *shell, size_t argc, char **argv)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
err = shell_cmd_precheck(shell, argc == 2);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ static int cmd_lspci(const struct shell *shell, size_t argc, char **argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -615,28 +615,6 @@ void shell_fprintf(const struct shell *shell, enum shell_vt100_color color,
|
||||||
*/
|
*/
|
||||||
void shell_process(const struct shell *shell);
|
void shell_process(const struct shell *shell);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Option descriptor.
|
|
||||||
*/
|
|
||||||
struct shell_getopt_option {
|
|
||||||
const char *optname; /*!< Option long name.*/
|
|
||||||
const char *optname_short; /*!< Option short name.*/
|
|
||||||
const char *optname_help; /*!< Option help string.*/
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Option structure initializer.
|
|
||||||
*
|
|
||||||
* @param[in] _optname Option name long.
|
|
||||||
* @param[in] _shortname Option name short.
|
|
||||||
* @param[in] _help Option help string.
|
|
||||||
*/
|
|
||||||
#define SHELL_OPT(_optname, _shortname, _help) { \
|
|
||||||
.optname = _optname, \
|
|
||||||
.optname_short = _shortname, \
|
|
||||||
.optname_help = _help, \
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Informs that a command has been called with -h or --help option.
|
* @brief Informs that a command has been called with -h or --help option.
|
||||||
*
|
*
|
||||||
|
@ -652,15 +630,12 @@ static inline bool shell_help_requested(const struct shell *shell)
|
||||||
/**
|
/**
|
||||||
* @brief Prints the current command help.
|
* @brief Prints the current command help.
|
||||||
*
|
*
|
||||||
* Function will print a help string with: the currently entered command, its
|
* Function will print a help string with the currently entered command and
|
||||||
* options,and subcommands (if they exist).
|
* its subcommands (if exist).
|
||||||
*
|
*
|
||||||
* @param[in] shell Pointer to the shell instance.
|
* @param[in] shell Pointer to the shell instance.
|
||||||
* @param[in] opt Pointer to the optional option array.
|
|
||||||
* @param[in] opt_len Option array size.
|
|
||||||
*/
|
*/
|
||||||
void shell_help_print(const struct shell *shell,
|
void shell_help_print(const struct shell *shell);
|
||||||
const struct shell_getopt_option *opt, size_t opt_len);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Change displayed shell prompt.
|
* @brief Change displayed shell prompt.
|
||||||
|
@ -680,17 +655,13 @@ int shell_prompt_change(const struct shell *shell, char *prompt);
|
||||||
*
|
*
|
||||||
* @param[in] shell Pointer to the shell instance.
|
* @param[in] shell Pointer to the shell instance.
|
||||||
* @param[in] arg_cnt_ok Flag indicating valid number of arguments.
|
* @param[in] arg_cnt_ok Flag indicating valid number of arguments.
|
||||||
* @param[in] opt Pointer to the optional option array.
|
|
||||||
* @param[in] opt_len Option array size.
|
|
||||||
*
|
*
|
||||||
* @return 0 if check passed
|
* @return 0 if check passed
|
||||||
* @return 1 if help was requested
|
* @return 1 if help was requested
|
||||||
* @return -EINVAL if wrong argument count
|
* @return -EINVAL if wrong argument count
|
||||||
*/
|
*/
|
||||||
int shell_cmd_precheck(const struct shell *shell,
|
int shell_cmd_precheck(const struct shell *shell,
|
||||||
bool arg_cnt_ok,
|
bool arg_cnt_ok);
|
||||||
const struct shell_getopt_option *opt,
|
|
||||||
size_t opt_len);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal @brief This function shall not be used directly, it is required by
|
* @internal @brief This function shall not be used directly, it is required by
|
||||||
|
|
|
@ -233,7 +233,7 @@ static int cmd_flash(const struct shell *shell, size_t argc, char **argv)
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ static int cmd_write_block_size(const struct shell *shell, size_t argc,
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int err = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int err = shell_cmd_precheck(shell, argc == 1);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -261,7 +261,7 @@ static int cmd_write_block_size(const struct shell *shell, size_t argc,
|
||||||
static int cmd_read(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_read(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
int err = shell_cmd_precheck(shell, (argc == 3), NULL, 0);
|
int err = shell_cmd_precheck(shell, argc == 3);
|
||||||
unsigned long int offset, len;
|
unsigned long int offset, len;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -287,7 +287,7 @@ exit:
|
||||||
|
|
||||||
static int cmd_erase(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_erase(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int err = shell_cmd_precheck(shell, (argc == 3), NULL, 0);
|
int err = shell_cmd_precheck(shell, argc == 3);
|
||||||
unsigned long int offset, size;
|
unsigned long int offset, size;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -312,7 +312,7 @@ exit:
|
||||||
|
|
||||||
static int cmd_write(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_write(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int err = shell_cmd_precheck(shell, (argc > 2), NULL, 0);
|
int err = shell_cmd_precheck(shell, argc > 2);
|
||||||
unsigned long int i, offset;
|
unsigned long int i, offset;
|
||||||
u8_t buf[ARGC_MAX];
|
u8_t buf[ARGC_MAX];
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ static int cmd_page_count(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int err = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int err = shell_cmd_precheck(shell, argc == 1);
|
||||||
size_t page_count;
|
size_t page_count;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -409,7 +409,7 @@ static bool page_layout_cb(const struct flash_pages_info *info, void *datav)
|
||||||
|
|
||||||
static int cmd_page_layout(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_page_layout(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int err = shell_cmd_precheck(shell, (argc <= 3), NULL, 0);
|
int err = shell_cmd_precheck(shell, argc <= 3);
|
||||||
unsigned long int start_page, end_page;
|
unsigned long int start_page, end_page;
|
||||||
struct page_layout_data data;
|
struct page_layout_data data;
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ static int cmd_page_read(const struct shell *shell, size_t argc, char **argv)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
||||||
ret = shell_cmd_precheck(shell, (argc == 3) || (argc == 4), NULL, 0);
|
ret = shell_cmd_precheck(shell, argc == 3 || argc == 4);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -512,7 +512,7 @@ static int cmd_page_erase(const struct shell *shell, size_t argc, char **argv)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = shell_cmd_precheck(shell, (argc == 2) || (argc == 3), NULL, 0);
|
ret = shell_cmd_precheck(shell, argc == 2 || argc == 3);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ static int cmd_page_write(const struct shell *shell, size_t argc, char **argv)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = shell_cmd_precheck(shell, (argc > 2), NULL, 0);
|
ret = shell_cmd_precheck(shell, argc > 2);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ static int cmd_set_dev(const struct shell *shell, size_t argc, char **argv)
|
||||||
const char *name;
|
const char *name;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
ret = shell_cmd_precheck(shell, argc == 2);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ static int cmd_read(const struct shell *shell, size_t argc, char *argv[])
|
||||||
u32_t *p_mem = (u32_t *) RESERVED_MEM_MAP;
|
u32_t *p_mem = (u32_t *) RESERVED_MEM_MAP;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ static int cmd_write_mcux(const struct shell *shell, size_t argc, char *argv[])
|
||||||
u32_t offset;
|
u32_t offset;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ static int cmd_write_stm32(const struct shell *shell, size_t argc, char *argv[])
|
||||||
struct device *flash_dev;
|
struct device *flash_dev;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ static int cmd_write(const struct shell *shell, size_t argc, char *argv[])
|
||||||
u32_t *p_mem = (u32_t *) (FLASH_MEM + 0x4000);
|
u32_t *p_mem = (u32_t *) (FLASH_MEM + 0x4000);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ static int cmd_run(const struct shell *shell, size_t argc, char *argv[])
|
||||||
void (*func_ptr)(void) = (void (*)(void)) RAM_MEM;
|
void (*func_ptr)(void) = (void (*)(void)) RAM_MEM;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ static int cmd_mtest(const struct shell *shell, size_t argc, char *argv[])
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc >= 2) && (argc <= 3), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc >= 2) && (argc <= 3));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ static int set_promisc_mode(const struct shell *shell,
|
||||||
int idx, ret;
|
int idx, ret;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ static int cmd_br_repair(const struct shell *shell,
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ static int cmd_coap_send(const struct shell *shell,
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ static int cmd_setip(const struct shell *shell, size_t argc, char *argv[])
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_NET_IPV6) && !IS_ENABLED(CONFIG_NET_IPV4)) {
|
if (IS_ENABLED(CONFIG_NET_IPV6) && !IS_ENABLED(CONFIG_NET_IPV4)) {
|
||||||
if (argc != 3 || shell_help_requested(shell)) {
|
if (argc != 3 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ static int cmd_setip(const struct shell *shell, size_t argc, char *argv[])
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_NET_IPV4) && !IS_ENABLED(CONFIG_NET_IPV6)) {
|
if (IS_ENABLED(CONFIG_NET_IPV4) && !IS_ENABLED(CONFIG_NET_IPV6)) {
|
||||||
if (argc != 2 || shell_help_requested(shell)) {
|
if (argc != 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ static int cmd_setip(const struct shell *shell, size_t argc, char *argv[])
|
||||||
if (IS_ENABLED(CONFIG_NET_IPV6) && IS_ENABLED(CONFIG_NET_IPV4)) {
|
if (IS_ENABLED(CONFIG_NET_IPV6) && IS_ENABLED(CONFIG_NET_IPV4)) {
|
||||||
if (net_addr_pton(AF_INET6, argv[start + 1], &ipv6) < 0) {
|
if (net_addr_pton(AF_INET6, argv[start + 1], &ipv6) < 0) {
|
||||||
if (argc != 2 || shell_help_requested(shell)) {
|
if (argc != 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ static int cmd_setip(const struct shell *shell, size_t argc, char *argv[])
|
||||||
net_sprint_ipv4_addr(&ipv4));
|
net_sprint_ipv4_addr(&ipv4));
|
||||||
} else {
|
} else {
|
||||||
if (argc != 3 || shell_help_requested(shell)) {
|
if (argc != 3 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ static int cmd_udp_download(const struct shell *shell, size_t argc,
|
||||||
do_init(shell);
|
do_init(shell);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,12 +693,12 @@ static int shell_cmd_upload(const struct shell *shell, size_t argc,
|
||||||
|
|
||||||
if (is_udp) {
|
if (is_udp) {
|
||||||
if (IS_ENABLED(CONFIG_NET_UDP)) {
|
if (IS_ENABLED(CONFIG_NET_UDP)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IS_ENABLED(CONFIG_NET_TCP)) {
|
if (IS_ENABLED(CONFIG_NET_TCP)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,12 +833,12 @@ static int shell_cmd_upload2(const struct shell *shell, size_t argc,
|
||||||
|
|
||||||
if (is_udp) {
|
if (is_udp) {
|
||||||
if (IS_ENABLED(CONFIG_NET_UDP)) {
|
if (IS_ENABLED(CONFIG_NET_UDP)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (IS_ENABLED(CONFIG_NET_TCP)) {
|
if (IS_ENABLED(CONFIG_NET_TCP)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -941,7 +941,7 @@ static int cmd_tcp(const struct shell *shell, size_t argc, char *argv[])
|
||||||
if (IS_ENABLED(CONFIG_NET_TCP)) {
|
if (IS_ENABLED(CONFIG_NET_TCP)) {
|
||||||
do_init(shell);
|
do_init(shell);
|
||||||
|
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ static int cmd_udp(const struct shell *shell, size_t argc, char *argv[])
|
||||||
if (IS_ENABLED(CONFIG_NET_UDP)) {
|
if (IS_ENABLED(CONFIG_NET_UDP)) {
|
||||||
do_init(shell);
|
do_init(shell);
|
||||||
|
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,7 +984,7 @@ static int cmd_tcp_download(const struct shell *shell, size_t argc,
|
||||||
do_init(shell);
|
do_init(shell);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ extern void qsort(void *a, size_t n, size_t es, cmp_t *cmp);
|
||||||
static int cmd_dynamic(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_dynamic(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if ((argc == 1) || shell_help_requested(shell)) {
|
if ((argc == 1) || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ static int cmd_dynamic_add(const struct shell *shell,
|
||||||
u16_t cmd_len;
|
u16_t cmd_len;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ static int cmd_dynamic_show(const struct shell *shell,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static int cmd_dynamic_execute(const struct shell *shell,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ static int cmd_dynamic_remove(const struct shell *shell, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
if ((argc == 1) || shell_help_requested(shell)) {
|
if ((argc == 1) || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ static int cmd_log_test_start(const struct shell *shell, size_t argc,
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int err = shell_cmd_precheck(shell, argc == 1, NULL, 0);
|
int err = shell_cmd_precheck(shell, argc == 1);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -62,7 +62,7 @@ static int cmd_log_test_stop(const struct shell *shell, size_t argc,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int err = shell_cmd_precheck(shell, argc == 1, NULL, 0);
|
int err = shell_cmd_precheck(shell, argc == 1);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -1576,7 +1576,7 @@ int cmd_timeout(const struct shell *shell, size_t argc, char *argv[])
|
||||||
s32_t timeout;
|
s32_t timeout;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc >= 1), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc >= 1));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1619,7 +1619,7 @@ static int cmd_fault_get(const struct shell *shell, size_t argc, char *argv[])
|
||||||
u16_t cid;
|
u16_t cid;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc == 1));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -2042,7 +2042,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(mesh_cmds) {
|
||||||
static int cmd_mesh(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_mesh(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ static int cmd_discovery(const struct shell *shell, size_t argc, char *argv[])
|
||||||
|
|
||||||
shell_print(shell, "Discovery stopped");
|
shell_print(shell, "Discovery stopped");
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -296,7 +296,7 @@ static int cmd_discoverable(const struct shell *shell,
|
||||||
} else if (!strcmp(action, "off")) {
|
} else if (!strcmp(action, "off")) {
|
||||||
err = bt_br_set_discoverable(false);
|
err = bt_br_set_discoverable(false);
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ static int cmd_connectable(const struct shell *shell,
|
||||||
} else if (!strcmp(action, "off")) {
|
} else if (!strcmp(action, "off")) {
|
||||||
err = bt_br_set_connectable(false);
|
err = bt_br_set_connectable(false);
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ static int cmd_sdp_find_record(const struct shell *shell,
|
||||||
} else if (!strcmp(action, "A2SRC")) {
|
} else if (!strcmp(action, "A2SRC")) {
|
||||||
discov = discov_a2src;
|
discov = discov_a2src;
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(br_cmds) {
|
||||||
static int cmd_br(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_br(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -613,7 +613,7 @@ static int cmd_scan(const struct shell *shell, size_t argc, char *argv[])
|
||||||
} else if (!strcmp(dup_filter, "nodups")) {
|
} else if (!strcmp(dup_filter, "nodups")) {
|
||||||
dups = BT_HCI_LE_SCAN_FILTER_DUP_ENABLE;
|
dups = BT_HCI_LE_SCAN_FILTER_DUP_ENABLE;
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -627,7 +627,7 @@ static int cmd_scan(const struct shell *shell, size_t argc, char *argv[])
|
||||||
} else if (!strcmp(action, "passive")) {
|
} else if (!strcmp(action, "passive")) {
|
||||||
return cmd_passive_scan_on(shell, dups);
|
return cmd_passive_scan_on(shell, dups);
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -702,7 +702,7 @@ static int cmd_advertise(const struct shell *shell, size_t argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +746,7 @@ static int cmd_disconnect(const struct shell *shell, size_t argc, char *argv[])
|
||||||
bt_addr_le_t addr;
|
bt_addr_le_t addr;
|
||||||
|
|
||||||
if (argc < 3) {
|
if (argc < 3) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -795,7 +795,7 @@ static int cmd_auto_conn(const struct shell *shell, size_t argc, char *argv[])
|
||||||
} else if (!strcmp(argv[3], "off")) {
|
} else if (!strcmp(argv[3], "off")) {
|
||||||
return bt_le_set_auto_conn(&addr, NULL);
|
return bt_le_set_auto_conn(&addr, NULL);
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -822,7 +822,7 @@ static int cmd_directed_adv(const struct shell *shell,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(argv[3], "low")) {
|
if (strcmp(argv[3], "low")) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1014,7 +1014,7 @@ static int cmd_bondable(const struct shell *shell, size_t argc, char *argv[])
|
||||||
} else if (!strcmp(bondable, "off")) {
|
} else if (!strcmp(bondable, "off")) {
|
||||||
bt_set_bondable(false);
|
bt_set_bondable(false);
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1208,7 +1208,7 @@ static int cmd_auth(const struct shell *shell, size_t argc, char *argv[])
|
||||||
} else if (!strcmp(argv[1], "none")) {
|
} else if (!strcmp(argv[1], "none")) {
|
||||||
bt_conn_auth_cb_register(NULL);
|
bt_conn_auth_cb_register(NULL);
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1389,7 +1389,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(bt_cmds) {
|
||||||
static int cmd_bt(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_bt(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -740,7 +740,7 @@ static int cmd_metrics(const struct shell *shell, size_t argc, char *argv[])
|
||||||
err = bt_gatt_service_unregister(&met_svc);
|
err = bt_gatt_service_unregister(&met_svc);
|
||||||
} else {
|
} else {
|
||||||
shell_error(shell, "Incorrect value: %s", argv[1]);
|
shell_error(shell, "Incorrect value: %s", argv[1]);
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,7 +796,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(gatt_cmds) {
|
||||||
static int cmd_gatt(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_gatt(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ static int cmd_metrics(const struct shell *shell, size_t argc, char *argv[])
|
||||||
} else if (!strcmp(action, "off")) {
|
} else if (!strcmp(action, "off")) {
|
||||||
l2cap_ops.recv = l2cap_recv;
|
l2cap_ops.recv = l2cap_recv;
|
||||||
} else {
|
} else {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(l2cap_cmds) {
|
||||||
static int cmd_l2cap(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_l2cap(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(rfcomm_cmds) {
|
||||||
static int cmd_rfcomm(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_rfcomm(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(ticker_cmds) {
|
||||||
static int cmd_ticker(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_ticker(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ static int cmd_trunc(const struct shell *shell, size_t argc, char **argv)
|
||||||
int length;
|
int length;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc >= 2), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc >= 2));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ static int cmd_mkdir(const struct shell *shell, size_t argc, char **argv)
|
||||||
int err;
|
int err;
|
||||||
char path[MAX_PATH_LEN];
|
char path[MAX_PATH_LEN];
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc == 2));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ static int cmd_rm(const struct shell *shell, size_t argc, char **argv)
|
||||||
int err;
|
int err;
|
||||||
char path[MAX_PATH_LEN];
|
char path[MAX_PATH_LEN];
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc == 2));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ static int cmd_read(const struct shell *shell, size_t argc, char **argv)
|
||||||
off_t offset;
|
off_t offset;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc >= 2), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc >= 2));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ static int cmd_write(const struct shell *shell, size_t argc, char **argv)
|
||||||
off_t offset = -1;
|
off_t offset = -1;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc >= 3), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc >= 3));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ static int cmd_mount_fat(const struct shell *shell, size_t argc, char **argv)
|
||||||
char *mntpt;
|
char *mntpt;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
res = shell_cmd_precheck(shell, (argc == 2));
|
||||||
if (res) {
|
if (res) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,7 @@ static int cmd_mount_nffs(const struct shell *shell, size_t argc, char **argv)
|
||||||
char *mntpt;
|
char *mntpt;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
res = shell_cmd_precheck(shell, (argc == 2));
|
||||||
if (res) {
|
if (res) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ static int log_enable(const struct shell *shell,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int severity_level;
|
int severity_level;
|
||||||
int err = shell_cmd_precheck(shell, (argc > 1), NULL, 0);
|
int err = shell_cmd_precheck(shell, (argc > 1));
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -254,7 +254,7 @@ static int log_disable(const struct shell *shell,
|
||||||
size_t argc,
|
size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int err = shell_cmd_precheck(shell, (argc > 1), NULL, 0);
|
int err = shell_cmd_precheck(shell, (argc > 1));
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -361,7 +361,7 @@ static int cmd_log_backends_list(const struct shell *shell,
|
||||||
size_t argc, char **argv)
|
size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int backend_count;
|
int backend_count;
|
||||||
int err = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int err = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -442,7 +442,7 @@ SHELL_CREATE_STATIC_SUBCMD_SET(sub_log_stat)
|
||||||
static int cmd_log(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_log(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
if ((argc == 1) || shell_help_requested(shell)) {
|
if ((argc == 1) || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1153,7 +1153,7 @@ static int cmd_net_allocs(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1381,7 +1381,7 @@ static int cmd_net_app(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1459,7 +1459,7 @@ static int cmd_net_arp(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1489,7 +1489,7 @@ static int cmd_net_arp_flush(const struct shell *shell, size_t argc,
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1512,7 +1512,7 @@ static int cmd_net_conn(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1694,7 +1694,7 @@ static int cmd_net_dns_cancel(const struct shell *shell, size_t argc,
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1732,7 +1732,7 @@ static int cmd_net_dns_query(const struct shell *shell, size_t argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1793,7 +1793,7 @@ static int cmd_net_dns(const struct shell *shell, size_t argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2339,7 +2339,7 @@ static int cmd_net_gptp_port(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2376,7 +2376,7 @@ static int cmd_net_gptp(const struct shell *shell, size_t argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2498,7 +2498,7 @@ static int cmd_net_http_monitor(const struct shell *shell, size_t argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2525,7 +2525,7 @@ static int cmd_net_http(const struct shell *shell, size_t argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2581,7 +2581,7 @@ static int cmd_net_iface_up(const struct shell *shell, size_t argc,
|
||||||
int idx, ret;
|
int idx, ret;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2619,7 +2619,7 @@ static int cmd_net_iface_down(const struct shell *shell, size_t argc,
|
||||||
int idx, ret;
|
int idx, ret;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2722,7 +2722,7 @@ static int cmd_net_ipv6(const struct shell *shell, size_t argc, char *argv[])
|
||||||
struct net_shell_user_data user_data;
|
struct net_shell_user_data user_data;
|
||||||
#endif
|
#endif
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2793,7 +2793,7 @@ static int cmd_net_iface(const struct shell *shell, size_t argc, char *argv[])
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2913,7 +2913,7 @@ static int cmd_net_mem(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2977,7 +2977,7 @@ static int cmd_net_nbr_rm(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3083,7 +3083,7 @@ static int cmd_net_nbr(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3248,7 +3248,7 @@ static int cmd_net_ping(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3307,7 +3307,7 @@ static int cmd_net_route(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3391,7 +3391,7 @@ static int cmd_net_rpl(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3552,7 +3552,7 @@ static int cmd_net_stacks(const struct shell *shell, size_t argc,
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3632,7 +3632,7 @@ static int cmd_net_stats_all(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3665,7 +3665,7 @@ static int cmd_net_stats_iface(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3704,7 +3704,7 @@ static int cmd_net_stats_iface(const struct shell *shell, size_t argc,
|
||||||
static int cmd_net_stats(const struct shell *shell, size_t argc, char *argv[])
|
static int cmd_net_stats(const struct shell *shell, size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3941,7 +3941,7 @@ static int cmd_net_tcp_connect(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3989,7 +3989,7 @@ static int cmd_net_tcp_send(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4044,7 +4044,7 @@ static int cmd_net_tcp_close(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4076,7 +4076,7 @@ static int cmd_net_tcp(const struct shell *shell, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4153,7 +4153,7 @@ static int cmd_net_vlan(const struct shell *shell, size_t argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4184,7 +4184,7 @@ static int cmd_net_vlan_add(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4261,7 +4261,7 @@ static int cmd_net_vlan_del(const struct shell *shell, size_t argc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ static int shell_cmd_connect(const struct shell *shell,
|
||||||
struct net_if *iface = net_if_get_default();
|
struct net_if *iface = net_if_get_default();
|
||||||
|
|
||||||
if (argc < 3 || shell_help_requested(shell)) {
|
if (argc < 3 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ static int shell_cmd_scan(const struct shell *shell,
|
||||||
struct net_if *iface = net_if_get_default();
|
struct net_if *iface = net_if_get_default();
|
||||||
|
|
||||||
if (argc < 2 || shell_help_requested(shell)) {
|
if (argc < 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ static int shell_cmd_disconnect(const struct shell *shell,
|
||||||
struct net_if *iface = net_if_get_default();
|
struct net_if *iface = net_if_get_default();
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static int shell_cmd_advertise(const struct shell *shell,
|
||||||
struct net_if *iface = net_if_get_default();
|
struct net_if *iface = net_if_get_default();
|
||||||
|
|
||||||
if (argc < 2 || shell_help_requested(shell)) {
|
if (argc < 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ static int cmd_ieee802154_ack(const struct shell *shell,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ static int cmd_ieee802154_associate(const struct shell *shell,
|
||||||
char ext_addr[MAX_EXT_ADDR_STR_LEN];
|
char ext_addr[MAX_EXT_ADDR_STR_LEN];
|
||||||
|
|
||||||
if (argc < 3 || shell_help_requested(shell)) {
|
if (argc < 3 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ static int cmd_ieee802154_disassociate(const struct shell *shell,
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ static int cmd_ieee802154_scan(const struct shell *shell,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (argc < 3 || shell_help_requested(shell)) {
|
if (argc < 3 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ static int cmd_ieee802154_set_chan(const struct shell *shell,
|
||||||
u16_t channel;
|
u16_t channel;
|
||||||
|
|
||||||
if (argc < 2 || shell_help_requested(shell)) {
|
if (argc < 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ static int cmd_ieee802154_get_chan(const struct shell *shell,
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ static int cmd_ieee802154_set_pan_id(const struct shell *shell,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
|
|
||||||
if (argc < 2 || shell_help_requested(shell)) {
|
if (argc < 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ static int cmd_ieee802154_get_pan_id(const struct shell *shell,
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ static int cmd_ieee802154_set_ext_addr(const struct shell *shell,
|
||||||
u8_t addr[IEEE802154_EXT_ADDR_LENGTH];
|
u8_t addr[IEEE802154_EXT_ADDR_LENGTH];
|
||||||
|
|
||||||
if (argc < 2 || shell_help_requested(shell)) {
|
if (argc < 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +464,7 @@ static int cmd_ieee802154_get_ext_addr(const struct shell *shell,
|
||||||
u8_t addr[IEEE802154_EXT_ADDR_LENGTH];
|
u8_t addr[IEEE802154_EXT_ADDR_LENGTH];
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ static int cmd_ieee802154_set_short_addr(const struct shell *shell,
|
||||||
u16_t short_addr;
|
u16_t short_addr;
|
||||||
|
|
||||||
if (argc < 2 || shell_help_requested(shell)) {
|
if (argc < 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ static int cmd_ieee802154_get_short_addr(const struct shell *shell,
|
||||||
u16_t short_addr;
|
u16_t short_addr;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ static int cmd_ieee802154_set_tx_power(const struct shell *shell,
|
||||||
s16_t tx_power;
|
s16_t tx_power;
|
||||||
|
|
||||||
if (argc < 2 || shell_help_requested(shell)) {
|
if (argc < 2 || shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ static int cmd_ieee802154_get_tx_power(const struct shell *shell,
|
||||||
s16_t tx_power;
|
s16_t tx_power;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,13 +152,13 @@ static int cmd_wifi_connect(const struct shell *shell, size_t argc,
|
||||||
int idx = 3;
|
int idx = 3;
|
||||||
|
|
||||||
if (shell_help_requested(shell) || argc < 3) {
|
if (shell_help_requested(shell) || argc < 3) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
cnx_params.ssid_length = strtol(argv[2], &endptr, 10);
|
cnx_params.ssid_length = strtol(argv[2], &endptr, 10);
|
||||||
if (*endptr != '\0' || cnx_params.ssid_length <= 2) {
|
if (*endptr != '\0' || cnx_params.ssid_length <= 2) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ static int cmd_wifi_connect(const struct shell *shell, size_t argc,
|
||||||
if ((idx < argc) && (strlen(argv[idx]) <= 2)) {
|
if ((idx < argc) && (strlen(argv[idx]) <= 2)) {
|
||||||
cnx_params.channel = strtol(argv[idx], &endptr, 10);
|
cnx_params.channel = strtol(argv[idx], &endptr, 10);
|
||||||
if (*endptr != '\0') {
|
if (*endptr != '\0') {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ static int cmd_wifi_disconnect(const struct shell *shell, size_t argc,
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ static int cmd_wifi_scan(const struct shell *shell, size_t argc, char *argv[])
|
||||||
struct net_if *iface = net_if_get_default();
|
struct net_if *iface = net_if_get_default();
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ static int ot_cmd(const struct shell *shell, size_t argc, char *argv[])
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -980,7 +980,7 @@ static int exec_cmd(const struct shell *shell, size_t argc, char **argv)
|
||||||
|
|
||||||
if (shell->ctx->active_cmd.handler == NULL) {
|
if (shell->ctx->active_cmd.handler == NULL) {
|
||||||
if (shell->ctx->active_cmd.help) {
|
if (shell->ctx->active_cmd.help) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
} else {
|
} else {
|
||||||
shell_fprintf(shell, SHELL_ERROR,
|
shell_fprintf(shell, SHELL_ERROR,
|
||||||
SHELL_MSG_SPECIFY_SUBCOMMAND);
|
SHELL_MSG_SPECIFY_SUBCOMMAND);
|
||||||
|
@ -1001,13 +1001,11 @@ static int exec_cmd(const struct shell *shell, size_t argc, char **argv)
|
||||||
((argc >= args->mandatory)
|
((argc >= args->mandatory)
|
||||||
&&
|
&&
|
||||||
(argc <= args->mandatory +
|
(argc <= args->mandatory +
|
||||||
args->optional)),
|
args->optional)));
|
||||||
NULL, 0);
|
|
||||||
} else {
|
} else {
|
||||||
/* Perform exact match if there are no optional args */
|
/* Perform exact match if there are no optional args */
|
||||||
ret_val = shell_cmd_precheck(shell,
|
ret_val = shell_cmd_precheck(shell,
|
||||||
(args->mandatory == argc),
|
(args->mandatory == argc));
|
||||||
NULL, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1661,57 +1659,6 @@ static void help_item_print(const struct shell *shell, const char *item_name,
|
||||||
formatted_text_print(shell, item_help, offset, false);
|
formatted_text_print(shell, item_help, offset, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void help_options_print(const struct shell *shell,
|
|
||||||
const struct shell_getopt_option *opt,
|
|
||||||
size_t opt_cnt)
|
|
||||||
{
|
|
||||||
static const char opt_sep[] = ", "; /* options separator */
|
|
||||||
static const char help_opt[] = "-h, --help";
|
|
||||||
u16_t longest_name = shell_strlen(help_opt);
|
|
||||||
|
|
||||||
shell_fprintf(shell, SHELL_NORMAL, "Options:\r\n");
|
|
||||||
|
|
||||||
if ((opt == NULL) || (opt_cnt == 0)) {
|
|
||||||
help_item_print(shell, help_opt, longest_name,
|
|
||||||
"Show command help.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Looking for the longest option string. */
|
|
||||||
for (size_t i = 0; i < opt_cnt; ++i) {
|
|
||||||
u16_t len = shell_strlen(opt[i].optname_short) +
|
|
||||||
shell_strlen(opt[i].optname) +
|
|
||||||
shell_strlen(opt_sep);
|
|
||||||
|
|
||||||
longest_name = len > longest_name ? len : longest_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* help option is printed first */
|
|
||||||
help_item_print(shell, help_opt, longest_name, "Show command help.");
|
|
||||||
|
|
||||||
/* prepare a buffer to compose a string:
|
|
||||||
* option name short - option separator - option name
|
|
||||||
*/
|
|
||||||
memset(shell->ctx->temp_buff, 0, longest_name + 1);
|
|
||||||
|
|
||||||
/* Formating and printing all available options (except -h, --help). */
|
|
||||||
for (size_t i = 0; i < opt_cnt; ++i) {
|
|
||||||
if (opt[i].optname_short) {
|
|
||||||
strcpy(shell->ctx->temp_buff, opt[i].optname_short);
|
|
||||||
}
|
|
||||||
if (opt[i].optname) {
|
|
||||||
if (*shell->ctx->temp_buff) {
|
|
||||||
strcat(shell->ctx->temp_buff, opt_sep);
|
|
||||||
strcat(shell->ctx->temp_buff, opt[i].optname);
|
|
||||||
} else {
|
|
||||||
strcpy(shell->ctx->temp_buff, opt[i].optname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
help_item_print(shell, shell->ctx->temp_buff, longest_name,
|
|
||||||
opt[i].optname_help);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Function is printing command help, its subcommands name and subcommands
|
/* Function is printing command help, its subcommands name and subcommands
|
||||||
* help string.
|
* help string.
|
||||||
*/
|
*/
|
||||||
|
@ -1763,8 +1710,7 @@ static void help_subcmd_print(const struct shell *shell)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void shell_help_print(const struct shell *shell,
|
void shell_help_print(const struct shell *shell)
|
||||||
const struct shell_getopt_option *opt, size_t opt_len)
|
|
||||||
{
|
{
|
||||||
__ASSERT_NO_MSG(shell);
|
__ASSERT_NO_MSG(shell);
|
||||||
|
|
||||||
|
@ -1773,7 +1719,6 @@ void shell_help_print(const struct shell *shell,
|
||||||
}
|
}
|
||||||
|
|
||||||
help_cmd_print(shell);
|
help_cmd_print(shell);
|
||||||
help_options_print(shell, opt, opt_len);
|
|
||||||
help_subcmd_print(shell);
|
help_subcmd_print(shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1793,12 +1738,10 @@ int shell_prompt_change(const struct shell *shell, char *prompt)
|
||||||
}
|
}
|
||||||
|
|
||||||
int shell_cmd_precheck(const struct shell *shell,
|
int shell_cmd_precheck(const struct shell *shell,
|
||||||
bool arg_cnt_ok,
|
bool arg_cnt_ok)
|
||||||
const struct shell_getopt_option *opt,
|
|
||||||
size_t opt_len)
|
|
||||||
{
|
{
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, opt, opt_len);
|
shell_help_print(shell);
|
||||||
return 1; /* help printed */
|
return 1; /* help printed */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1808,7 +1751,7 @@ int shell_cmd_precheck(const struct shell *shell,
|
||||||
shell->ctx->active_cmd.syntax);
|
shell->ctx->active_cmd.syntax);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_SHELL_HELP_ON_WRONG_ARGUMENT_COUNT)) {
|
if (IS_ENABLED(CONFIG_SHELL_HELP_ON_WRONG_ARGUMENT_COUNT)) {
|
||||||
shell_help_print(shell, opt, opt_len);
|
shell_help_print(shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -184,7 +184,7 @@ static int cmd_clear(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -198,7 +198,7 @@ static int cmd_clear(const struct shell *shell, size_t argc, char **argv)
|
||||||
|
|
||||||
static int cmd_shell(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_shell(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 2));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -215,7 +215,7 @@ static int cmd_bacskpace_mode_backspace(const struct shell *shell, size_t argc,
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell->ctx->internal.flags.mode_delete = 0;
|
shell->ctx->internal.flags.mode_delete = 0;
|
||||||
|
@ -229,7 +229,7 @@ static int cmd_bacskpace_mode_delete(const struct shell *shell, size_t argc,
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell->ctx->internal.flags.mode_delete = 1;
|
shell->ctx->internal.flags.mode_delete = 1;
|
||||||
|
@ -241,7 +241,7 @@ static int cmd_bacskpace_mode_delete(const struct shell *shell, size_t argc,
|
||||||
static int cmd_bacskpace_mode(const struct shell *shell, size_t argc,
|
static int cmd_bacskpace_mode(const struct shell *shell, size_t argc,
|
||||||
char **argv)
|
char **argv)
|
||||||
{
|
{
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 2));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -257,7 +257,7 @@ static int cmd_colors_off(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell->ctx->internal.flags.use_colors = 0;
|
shell->ctx->internal.flags.use_colors = 0;
|
||||||
|
@ -270,7 +270,7 @@ static int cmd_colors_on(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell->ctx->internal.flags.use_colors = 1;
|
shell->ctx->internal.flags.use_colors = 1;
|
||||||
|
@ -281,7 +281,7 @@ static int cmd_colors_on(const struct shell *shell, size_t argc, char **argv)
|
||||||
|
|
||||||
static int cmd_colors(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_colors(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 2));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -297,7 +297,7 @@ static int cmd_echo_off(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell->ctx->internal.flags.echo = 0;
|
shell->ctx->internal.flags.echo = 0;
|
||||||
|
@ -310,7 +310,7 @@ static int cmd_echo_on(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell->ctx->internal.flags.echo = 1;
|
shell->ctx->internal.flags.echo = 1;
|
||||||
|
@ -321,7 +321,7 @@ static int cmd_echo_on(const struct shell *shell, size_t argc, char **argv)
|
||||||
|
|
||||||
static int cmd_echo(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_echo(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret = shell_cmd_precheck(shell, (argc <= 2), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc <= 2));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -367,7 +367,7 @@ static int cmd_history(const struct shell *shell, size_t argc, char **argv)
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -401,7 +401,7 @@ static int cmd_shell_stats_show(const struct shell *shell, size_t argc,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell_fprintf(shell, SHELL_NORMAL, "Lost logs: %u\n",
|
shell_fprintf(shell, SHELL_NORMAL, "Lost logs: %u\n",
|
||||||
|
@ -421,7 +421,7 @@ static int cmd_shell_stats_reset(const struct shell *shell,
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
shell->stats->log_lost_cnt = 0;
|
shell->stats->log_lost_cnt = 0;
|
||||||
|
@ -435,10 +435,10 @@ static int cmd_shell_stats(const struct shell *shell, size_t argc, char **argv)
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
|
|
||||||
if (shell_help_requested(shell)) {
|
if (shell_help_requested(shell)) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (argc == 1) {
|
} else if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
} else {
|
} else {
|
||||||
shell_fprintf(shell, SHELL_ERROR, "%s:%s%s\n", argv[0],
|
shell_fprintf(shell, SHELL_ERROR, "%s:%s%s\n", argv[0],
|
||||||
SHELL_MSG_UNKNOWN_PARAMETER, argv[1]);
|
SHELL_MSG_UNKNOWN_PARAMETER, argv[1]);
|
||||||
|
@ -452,7 +452,7 @@ static int cmd_resize_default(const struct shell *shell,
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
int ret = shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
int ret = shell_cmd_precheck(shell, (argc == 1));
|
||||||
|
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
SHELL_VT100_CMD(shell, SHELL_VT100_SETCOL_80);
|
SHELL_VT100_CMD(shell, SHELL_VT100_SETCOL_80);
|
||||||
|
@ -474,7 +474,7 @@ static int cmd_resize(const struct shell *shell, size_t argc, char **argv)
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = shell_cmd_precheck(shell, (argc <= 2), NULL, 0);
|
err = shell_cmd_precheck(shell, (argc <= 2));
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ static bool hrs_simulate;
|
||||||
static int cmd_hrs_simulate(const struct shell *shell,
|
static int cmd_hrs_simulate(const struct shell *shell,
|
||||||
size_t argc, char *argv[])
|
size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
int err = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
int err = shell_cmd_precheck(shell, (argc == 2));
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
|
@ -55,7 +55,7 @@ static int cmd_hrs_simulate(const struct shell *shell,
|
||||||
hrs_simulate = false;
|
hrs_simulate = false;
|
||||||
} else {
|
} else {
|
||||||
shell_print(shell, "Incorrect value: %s", argv[1]);
|
shell_print(shell, "Incorrect value: %s", argv[1]);
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,10 @@ SHELL_CREATE_STATIC_SUBCMD_SET(hrs_cmds) {
|
||||||
|
|
||||||
static int cmd_hrs(const struct shell *shell, size_t argc, char **argv)
|
static int cmd_hrs(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
int err = shell_cmd_precheck(shell, (argc == 2), NULL, 0);
|
int err = shell_cmd_precheck(shell, (argc == 2));
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
shell_help_print(shell, NULL, 0);
|
shell_help_print(shell);
|
||||||
/* shell_cmd_precheck returns 1 when help is printed */
|
/* shell_cmd_precheck returns 1 when help is printed */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,7 +196,7 @@ static int cmd_test_module(const struct shell *shell, size_t argc, char **argv)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
return shell_cmd_precheck(shell, (argc == 1), NULL, 0);
|
return shell_cmd_precheck(shell, (argc == 1));
|
||||||
}
|
}
|
||||||
SHELL_CMD_REGISTER(test_shell_cmd, NULL, NULL, cmd_test_module);
|
SHELL_CMD_REGISTER(test_shell_cmd, NULL, NULL, cmd_test_module);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue