+static const struct command_registration command_subcommand_handlers[] = {
+ {
+ .name = "mode",
+ .mode = COMMAND_ANY,
+ .jim_handler = jim_command_mode,
+ .usage = "[command_name ...]",
+ .help = "Returns the command modes allowed by a command:"
+ "'any', 'config', or 'exec'. If no command is"
+ "specified, returns the current command mode. "
+ "Returns 'unknown' if an unknown command is given. "
+ "Command can be multiple tokens.",
+ },
+ {
+ .name = "type",
+ .mode = COMMAND_ANY,
+ .jim_handler = jim_command_type,
+ .usage = "command_name [...]",
+ .help = "Returns the type of built-in command:"
+ "'native', 'simple', 'group', or 'unknown'. "
+ "Command can be multiple tokens.",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
+static const struct command_registration command_builtin_handlers[] = {
+ {
+ .name = "echo",
+ .handler = jim_echo,
+ .mode = COMMAND_ANY,
+ .help = "Logs a message at \"user\" priority. "
+ "Output message to stdout. "
+ "Option \"-n\" suppresses trailing newline",
+ .usage = "[-n] string",
+ },
+ {
+ .name = "add_help_text",
+ .handler = handle_help_add_command,
+ .mode = COMMAND_ANY,
+ .help = "Add new command help text; "
+ "Command can be multiple tokens.",
+ .usage = "command_name helptext_string",
+ },
+ {
+ .name = "add_usage_text",
+ .handler = handle_help_add_command,
+ .mode = COMMAND_ANY,
+ .help = "Add new command usage text; "
+ "command can be multiple tokens.",
+ .usage = "command_name usage_string",
+ },
+ {
+ .name = "sleep",
+ .handler = handle_sleep_command,
+ .mode = COMMAND_ANY,
+ .help = "Sleep for specified number of milliseconds. "
+ "\"busy\" will busy wait instead (avoid this).",
+ .usage = "milliseconds ['busy']",
+ },
+ {
+ .name = "help",
+ .handler = handle_help_command,
+ .mode = COMMAND_ANY,
+ .help = "Show full command help; "
+ "command can be multiple tokens.",
+ .usage = "[command_name]",
+ },
+ {
+ .name = "usage",
+ .handler = handle_help_command,
+ .mode = COMMAND_ANY,
+ .help = "Show basic command usage; "
+ "command can be multiple tokens.",
+ .usage = "[command_name]",
+ },
+ {
+ .name = "command",
+ .mode= COMMAND_ANY,
+ .help = "core command group (introspection)",
+ .chain = command_subcommand_handlers,
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
+struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp)