nsh/command: do not show the module application in built-in list

Change-Id: Ia6dd5dcf7d7eb829fde67c522f7ee2155a4051ce
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2020-02-21 10:32:23 +08:00 committed by Masayuki Ishikawa
parent 97b439f180
commit 9968461c2b

View File

@ -766,12 +766,12 @@ static inline void help_allcmds(FAR struct nsh_vtbl_s *vtbl)
static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
{
#ifdef CONFIG_NSH_BUILTIN_APPS
FAR const char *name;
unsigned int num_builtins;
unsigned int column_width;
unsigned int builtin_width;
FAR const struct builtin_s *builtin;
unsigned int builtins_per_line;
unsigned int num_builtin_rows;
unsigned int builtin_width;
unsigned int num_builtins;
unsigned int column_width;
unsigned int i;
unsigned int j;
unsigned int k;
@ -781,17 +781,29 @@ static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
num_builtins = 0;
column_width = 0;
for (i = 0; (name = builtin_getname(i)) != NULL; i++)
for (i = 0; (builtin = builtin_for_index(i)) != NULL; i++)
{
if (builtin->main == NULL)
{
continue;
}
num_builtins++;
builtin_width = strlen(name);
builtin_width = strlen(builtin->name);
if (builtin_width > column_width)
{
column_width = builtin_width;
}
}
/* Skip the printing if no available built-in commands */
if (num_builtins == 0)
{
return;
}
column_width += 2;
/* Determine the number of commands to put on one line */
@ -817,13 +829,18 @@ static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
{
nsh_output(vtbl, " ");
for (j = 0, k = i;
j < builtins_per_line && k < num_builtins;
j < builtins_per_line &&
(builtin = builtin_for_index(k));
j++, k += num_builtin_rows)
{
name = builtin_getname(k);
nsh_output(vtbl, "%s", name);
if (builtin->main == NULL)
{
continue;
}
for (builtin_width = strlen(name);
nsh_output(vtbl, "%s", builtin->name);
for (builtin_width = strlen(builtin->name);
builtin_width < column_width;
builtin_width++)
{