summaryrefslogtreecommitdiff
path: root/avr/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/env.c')
-rw-r--r--avr/env.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/avr/env.c b/avr/env.c
index 44c5742..add281c 100644
--- a/avr/env.c
+++ b/avr/env.c
@@ -795,3 +795,91 @@ int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf)
return found;
}
#endif
+
+cmd_tbl_t cmd_tbl_env[] = {
+CMD_TBL_ITEM_COMPLETE(
+ printenv, CONFIG_SYS_MAXARGS, 1|CTBL_SUBCMDAUTO, do_env_print,
+ "print environment variables",
+ "[-s] [name ...]\n"
+ " Print value of environment variable(s) 'name'\n"
+ " If no names are given, print values of all environment variables\n"
+ " -s Print in setenv form",
+ var_complete
+),
+CMD_TBL_ITEM_COMPLETE(
+ setenv, CONFIG_SYS_MAXARGS, CTBL_SUBCMDAUTO, do_env_set,
+ "set environment variables",
+ "name value ...\n"
+ " - set environment variable 'name' to 'value ...'\n"
+ "setenv name\n"
+ " - delete environment variable 'name'",
+ var_complete
+),
+CMD_TBL_ITEM(
+ saveenv, 1, CTBL_SUBCMDAUTO, do_env_save,
+ "save environment variables to persistent storage",
+ ""
+),
+CMD_TBL_ITEM(
+ defaultenv, 1, CTBL_SUBCMDAUTO, do_env_default,
+ "set all environment variables to their default values",
+ ""
+),
+
+CMD_TBL_ITEM_COMPLETE(
+ print, CONFIG_SYS_MAXARGS, 1, do_env_print,
+ "print environment variables",
+ "[-s] [name ...]\n"
+ " Print value of environment variable(s) 'name'\n"
+ " If no names are given, print values of all environment variables\n"
+ " -s Print in setenv form",
+ var_complete
+),
+CMD_TBL_ITEM_COMPLETE(
+ set, CONFIG_SYS_MAXARGS, 0, do_env_set,
+ "set environment variables",
+ "name value ...\n"
+ " - set environment variable 'name' to 'value ...'\n"
+ "setenv name\n"
+ " - delete environment variable 'name'",
+ var_complete
+),
+CMD_TBL_ITEM(
+ save, 1, 0, do_env_save,
+ "save environment variables to persistent storage",
+ ""
+),
+CMD_TBL_ITEM(
+ default, 1, 0, do_env_default,
+ "set all environment variables to their default values",
+ ""
+),
+
+CMD_TBL_ITEM(
+ help, CONFIG_SYS_MAXARGS, CTBL_RPT, do_help,
+ "Print sub command description/usage",
+ "\n"
+ " - print brief description of all sub commands\n"
+ "env help command ...\n"
+ " - print detailed usage of sub cmd 'command'"
+),
+
+/* This does not use the CMD_TBL_ITEM macro as ? can't be used in symbol names */
+ {FSTR("?"), CONFIG_SYS_MAXARGS, 1, do_help,
+ NULL,
+#ifdef CONFIG_SYS_LONGHELP
+ FSTR(""),
+#endif /* CONFIG_SYS_LONGHELP */
+ NULL,
+#ifdef CONFIG_AUTO_COMPLETE
+ NULL,
+#endif
+},
+/* Mark end of table */
+CMD_TBL_END(cmd_tbl_env)
+};
+
+command_ret_t do_env(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc UNUSED, char * const argv[] UNUSED)
+{
+ return CMD_RET_USAGE;
+}