nshlib: Rename 'sh' command to 'source' command

since this command change the parent environment variable and
add new '.' command which has the same functionality as 'source'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2020-04-18 21:57:26 +08:00
committed by patacongo
parent 9ab5e2ff45
commit d307758c3c
6 changed files with 28 additions and 22 deletions

View File

@@ -85,6 +85,12 @@ static int cmd_unrecognized(FAR struct nsh_vtbl_s *vtbl, int argc,
static const struct cmdmap_s g_cmdmap[] =
{
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SOURCE
{ ".", cmd_source, 2, 2, "<script-path>" },
# endif
#endif
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
{ "[", cmd_lbracket, 4, CONFIG_NSH_MAXARGUMENTS, "<expression> ]" },
#endif
@@ -478,12 +484,6 @@ static const struct cmdmap_s g_cmdmap[] =
#endif
#endif /* CONFIG_NSH_DISABLE_SET */
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SH
{ "sh", cmd_sh, 2, 2, "<script-path>" },
# endif
#endif
#ifndef CONFIG_NSH_DISABLE_SHUTDOWN
#if defined(CONFIG_BOARDCTL_POWEROFF) && defined(CONFIG_BOARDCTL_RESET)
{ "shutdown", cmd_shutdown, 1, 2, "[--reboot]" },
@@ -498,6 +498,12 @@ static const struct cmdmap_s g_cmdmap[] =
{ "sleep", cmd_sleep, 2, 2, "<sec>" },
#endif
#if CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT)
# ifndef CONFIG_NSH_DISABLE_SOURCE
{ "source", cmd_source, 2, 2, "<script-path>" },
# endif
#endif
#if !defined(CONFIG_NSH_DISABLESCRIPT) && !defined(CONFIG_NSH_DISABLE_TEST)
{ "test", cmd_test, 3, CONFIG_NSH_MAXARGUMENTS, "<expression>" },
#endif