Skip to content

Commit 46fa538

Browse files
committed
doc: Fix layout of the shell documentation
Change-Id: I51613070cd1e8bc664212f33d985a6ecd217cee6 Signed-off-by: Anas Nashif <[email protected]>
1 parent fad7e2d commit 46fa538

File tree

2 files changed

+55
-51
lines changed

2 files changed

+55
-51
lines changed

doc/subsystems/shell.rst

Lines changed: 53 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,44 @@ Use one of the following formats:
1919

2020
Specific module's commands
2121
==========================
22-
`MODULE_NAME COMMAND`
23-
One of the available modules is “KERNEL”, for the Kernel module.
24-
More information can be found in :c:macro:`SHELL_REGISTER`.
22+
`MODULE_NAME COMMAND`
23+
One of the available modules is “KERNEL”, for the Kernel module. More
24+
information can be found in :c:macro:`SHELL_REGISTER`.
2525

2626
Help commands
2727
=============
28-
`help`
29-
Prints the available modules.
30-
`help MODULE_NAME`
31-
Prints the names of the available commands for the module.
32-
`help MODULE_NAME COMMAND`
33-
Prints help for the module's command (the help should show function
34-
goal and required parameters).
28+
`help`
29+
Prints the available modules.
30+
31+
`help MODULE_NAME`
32+
Prints the names of the available commands for the module.
33+
34+
`help MODULE_NAME COMMAND`
35+
Prints help for the module's command (the help should show function
36+
goal and required parameters).
3537

3638
Select module commands
3739
======================
38-
`set_module MODULE_NAME`
39-
Use this command when using the shell only for one module.
40-
After entering this command, you will not need to enter module
41-
name in further commands.
42-
If the selected module has set a default shell prompt during its
43-
initialization, the prompt will be changed to that one.
44-
Otherwise, the prompt will be changed to the selected module’s name to
45-
reflect the current module in use.
46-
`set_module`
47-
Clears selected module. Restores prompt as well.
40+
`set_module MODULE_NAME`
41+
Use this command when using the shell only for one module. After entering this
42+
command, you will not need to enter module name in further commands. If
43+
the selected module has set a default shell prompt during its initialization,
44+
the prompt will be changed to that one. Otherwise, the prompt will be
45+
changed to the selected module’s name to reflect the current module in use.
46+
47+
`set_module`
48+
Clears selected module. Restores prompt as well.
4849

4950
Shell configuration
5051
*******************
5152
There are two levels of configuration: Infrastructure level and Module level.
5253

5354
Infrastructure level
5455
====================
56+
5557
The default value for ENABLE_SHELL flag should be considered per product.
5658
This flag enables shell services.
59+
5760
If it is enabled, kernel shell commands are also available for use.
5861
See the :option:`CONFIG_ENABLE_SHELL` Kconfig options for more information.
5962

@@ -62,6 +65,7 @@ Module level
6265
Each module using shell service should add a unique flag in its Kconfig file.
6366

6467
Example:
68+
6569
CONFIG_SAMPLE_MODULE_USE_SHELL=y
6670

6771
In the module’s code, the shell usage depends on this config parameter.
@@ -73,51 +77,51 @@ The default value for ENABLE_SHELL flag should be considered per product.
7377

7478
Configuration steps to add shell functionality to a module
7579
==========================================================
80+
7681
#. Check that ENABLE_SHELL is set to yes.
7782
#. Add the module unique flag to its Kconfig file.
7883

79-
8084
Writing a shell module
8185
**********************
86+
8287
In order to support shell in your module, the application must do the following:
8388

84-
#. Module configuration flag:
85-
Declare a new flag in your module Kconfig file.
86-
It should depend on `ENABLE_SHELL` flag.
89+
#. Module configuration flag: Declare a new flag in your module Kconfig file.
90+
It should depend on `ENABLE_SHELL` flag.
91+
92+
#. Module registration to shell: Add your shell identifier and register its
93+
callback functions in the shell database using :c:macro:`SHELL_REGISTER`.
94+
95+
Optionally, you can use one of the following API functions to override default
96+
behvior and settings:
8797

88-
#. Module registration to shell:
89-
Add your shell identifier and register its callback functions in the
90-
shell database using :c:macro:`SHELL_REGISTER`.
98+
* :c:func:`shell_register_default_module`
9199

92-
#. Optional:
93-
:c:func:`shell_register_default_module`
100+
* :c:func:`shell_register_prompt_handler`
94101

95-
:c:func:`shell_register_prompt_handler`
102+
In case of a sample applications as well as test environment, user can choose to
103+
set a default module in code level. In this case, the function
104+
shell_register_default_module should be called after calling SHELL_REGISTER in
105+
application level. If the function shell_register_prompt_handler was called as
106+
well, the prompt will be changed to that one. Otherwise, the prompt will be
107+
changed to the selected module’s name, in order to reflect the current module in
108+
use.
96109

97-
Usage:
98-
In case of a sample applications as well as test environment,
99-
user can choose to set a default module in code level.
100-
In this case, the function shell_register_default_module should
101-
be called after calling SHELL_REGISTER in application level.
102-
If the function shell_register_prompt_handler was called
103-
as well, the prompt will be changed to that one.
104-
Otherwise, the prompt will be changed to the selected module’s
105-
name, in order to reflect the current module in use.
106110

107-
Note:
108-
Even if a default module was set in code level, it can be
109-
overwritten by “set_module” shell command.
111+
.. note::
112+
Even if a default module was set in code level, it can be overwritten by
113+
“set_module” shell command.
110114

111-
When to use shell_register_default_module:
115+
You can use :c:func:`shell_register_default_module` in the following cases:
112116

113-
* Use this command in case of using the shell only for one module.
114-
After entering this command, no need to enter module name in further
115-
commands.
117+
* Use this command in case of using the shell only for one module.
118+
After entering this command, no need to enter module name in further
119+
commands.
116120

117-
* Use this function for shell backward compatibility.
121+
* Use this function for shell backward compatibility.
118122

119-
More details on those optional functions can be found
120-
in :ref:`shell_api_functions`.
123+
More details on those optional functions can be found in
124+
:ref:`shell_api_functions`.
121125

122126

123127
.. _shell_api_functions:

include/misc/shell.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ struct shell_module {
4646

4747

4848
/**
49-
* @brief Kernel Shell Api
50-
* @defgroup _shell_api_functions Shell Api Functions
49+
* @brief Kernel Shell API
50+
* @defgroup _shell_api_functions Shell API Functions
5151
* @{
5252
*/
5353

0 commit comments

Comments
 (0)