Lines Matching refs:command

13 This module allows you to create and handle a shell with a user-defined command
21 * Smart command completion with the :kbd:`Tab` key.
22 * Built-in commands: :command:`clear`, :command:`shell`, :command:`colors`,
23 :command:`echo`, :command:`history` and :command:`resize`.
43 The module can be connected to any transport for command input and output.
83 * Root command (level 0): Gathered and alphabetically sorted in a dedicated
96 * :c:macro:`SHELL_CMD_REGISTER` - Create root command. All root commands must
99 set) create root command. All root commands must have different name.
100 * :c:macro:`SHELL_CMD_ARG_REGISTER` - Create root command with arguments.
103 is set) create root command with arguments. All root commands must have
105 * :c:macro:`SHELL_CMD` - Initialize a command.
106 * :c:macro:`SHELL_COND_CMD` - Initialize a command if compile time flag is set.
107 * :c:macro:`SHELL_EXPR_CMD` - Initialize a command if compile time expression is
109 * :c:macro:`SHELL_CMD_ARG` - Initialize a command with arguments.
110 * :c:macro:`SHELL_COND_CMD_ARG` - Initialize a command with arguments if compile
112 * :c:macro:`SHELL_EXPR_CMD_ARG` - Initialize a command with arguments if compile
127 Example code demonstrating how to create a root command with static
136 /* Creating subcommands (level 1 command) array for command "demo". */
138 SHELL_CMD(params, NULL, "Print params command.",
140 SHELL_CMD(ping, NULL, "Ping command.", cmd_demo_ping),
143 /* Creating root (level 0) command "demo" */
153 a command handler. The string is usually a verbal description of a given data.
154 The idea is to use the string as a command syntax that can be prompted by the
155 shell and corresponding data can be used to process the command.
157 Let's use an example. Suppose you created a command to set an ADC gain.
171 /* data is a value corresponding to called command syntax */
198 Example code demonstrating how to create a root command with static and dynamic
199 subcommands. At the beginning dynamic command list is empty. New commands
220 /* Function returning command dynamically created
230 entry->help = "Show dynamic command name.";
241 SHELL_CMD(add, NULL,"Add new command to dynamic_cmd_buffer and"
245 "Execute a command.", cmd_dynamic_execute),
247 "Remove a command from dynamic_cmd_buffer.",
255 "Demonstrate dynamic command usage.", cmd_dynamic);
263 Each command or subcommand may have a handler. The shell executes the handler
264 that is found deepest in the command tree and further subcommands (without a
275 /* Below code will execute "clear" command on a DUMMY backend */
278 /* Below code will execute "shell colors off" command on
292 Simple command handler implementation:
315 :c:macro:`shell_error` can be used from the command handler or from threads,
322 Every user-defined command or subcommand can have its own help description.
327 Shell prints this help message when you call a command
348 /* If it is a subcommand handler parent command syntax
351 shell_print(shell, "This command has a parent command: %s",
354 /* Print this command syntax */
355 shell_print(shell, "This command syntax is: %s", argv[0]);
368 * :command:`clear` - Clears the screen.
369 * :command:`history` - Shows the recently entered commands.
370 * :command:`resize` - Must be executed when terminal width is different than 80
373 handling. Currently this command works only with UART flow control switched
376 * :command:`default` - Shell will send terminal width = 80 to the
379 These command needs extra activation:
381 * :command:`select` - It can be used to set new root command. Exit to main
382 command tree is with alt+r. This command needs extra activation:
384 * :command:`shell` - Root command with useful shell-related subcommands like:
386 * :command:`echo` - Toggles shell echo.
387 * :command:`colors` - Toggles colored syntax. This might be helpful in
389 * :command:`stats` - Shows shell statistics.
400 When user starts writing a command and presses the :kbd:`Tab` button then
403 * Autocomplete the command.
404 * Prompts available commands and if possible partly completes the command.
425 when expanded command and its subcommands do not have a handler. For example,
427 modules you can execute the following command:
455 - Preserves the last command on the screen and starts a new command in
466 - Clears the screen and leaves the currently typed command at the top of
473 - Clears the currently typed command.
524 of any other command besides a login command, by means of the
537 new message is enqueued. Use the ``shell stats show`` command to retrieve
595 /* Creating subcommands (level 1 command) array for command "demo". */
597 SHELL_CMD(params, NULL, "Print params command.",
599 SHELL_CMD(ping, NULL, "Ping command.", cmd_demo_ping),
602 /* Creating root (level 0) command "demo" without a handler */
605 /* Creating root (level 0) command "version" */
609 Users may use the :kbd:`Tab` key to complete a command/subcommand or to see the
610 available subcommands for the currently entered command level.
611 For example, when the cursor is positioned at the beginning of the command
621 To view the subcommands that are available for a specific command, you
622 must first type a :kbd:`space` after this command and then hit
627 * :command:`clear`, :command:`shell`, :command:`history`, and :command:`resize`
630 * :command:`demo` and :command:`version` have been registered in example code
632 * :command:`log` has been registered by :zephyr_file:`subsys/logging/log_cmds.c`
634 Then, if a user types a :command:`demo` command and presses the :kbd:`Tab` key,
635 the shell will only print the subcommands registered for this command: