1# Shell configuration options
2
3# Copyright (c) 2014-2015 Wind River Systems, Inc.
4# Copyright (c) 2016 Intel Corporation
5# Copyright (c) 2018 Nordic Semiconductor ASA
6# SPDX-License-Identifier: Apache-2.0
7
8menuconfig SHELL
9	bool "Shell"
10	imply LOG_RUNTIME_FILTERING
11	select POLL
12
13if SHELL
14
15module = SHELL
16module-str = Shell
17source "subsys/logging/Kconfig.template.log_config"
18source "subsys/shell/backends/Kconfig.backends"
19
20config SHELL_MINIMAL
21	bool "Default config to reduce flash and memory requirements"
22	help
23	  This is a meta-configuration option to significantly reduce the flash
24	  and memory requirements of the shell.  Enabling it will choose Kconfig
25	  defaults which favor reduced flash or memory requirements over extra
26	  features.
27
28config SHELL_THREAD_PRIORITY_OVERRIDE
29	bool "Override default shell thread priority"
30	help
31	  Option to change the default value of shell thread priority.
32
33if SHELL_THREAD_PRIORITY_OVERRIDE
34config SHELL_THREAD_PRIORITY
35	int "Shell thread priority"
36	default 0
37	help
38	  Set thread priority of the shell
39endif
40
41config SHELL_STACK_SIZE
42	int "Shell thread stack size"
43	default 3168 if OPENTHREAD_SHELL && OPENTHREAD_JOINER
44	default 3072 if 64BIT
45	default 2616 if OPENTHREAD_SHELL
46	default 2048 if MULTITHREADING
47	default 0 if !MULTITHREADING
48	help
49	  Stack size for thread created for each instance.
50
51config SHELL_BACKSPACE_MODE_DELETE
52	bool "Default escape code for backspace is DELETE (0x7F)"
53	default y
54	help
55	  Terminals have different escape code settings for backspace button.
56	  Some terminals send code: 0x08 (backspace) other 0x7F (delete). When
57	  this option is set shell will expect 0x7F for backspace key.
58
59config SHELL_CMD_BUFF_SIZE
60	int "Shell command buffer size"
61	default 128 if SHELL_MINIMAL
62	default 256
63	help
64	  Maximum command size in bytes. One byte is reserved for the string
65	  terminator character.
66
67config SHELL_PRINTF_BUFF_SIZE
68	int "Shell print buffer size"
69	default 30
70	help
71	  Maximum text buffer size for fprintf function.
72	  It is working like stdio buffering in Linux systems
73	  to limit number of peripheral access calls.
74
75config SHELL_DEFAULT_TERMINAL_WIDTH
76	int "Default terminal width"
77	default 80
78	help
79	  Default terminal width is used to break lines.
80
81config SHELL_DEFAULT_TERMINAL_HEIGHT
82	int "Default terminal height"
83	default 24
84
85config SHELL_ARGC_MAX
86	int "Maximum arguments in shell command"
87	range 3 255
88	default 20
89	help
90	  Maximum number of arguments that can build a command.
91
92config SHELL_TAB
93	bool "The Tab button support in shell"
94	default y if !SHELL_MINIMAL && !SHELL_BACKEND_RTT
95	help
96	  Enable using the Tab button in the shell. The button
97	  can be used for prompting commands, or for autocompletion.
98	  This feature has high impact on flash usage.
99
100config SHELL_TAB_AUTOCOMPLETION
101	bool "Commands autocompletion with the Tab button"
102	depends on SHELL_TAB
103	default y if !SHELL_MINIMAL
104	help
105	  Enable commands and subcommands autocompletion with the Tab
106	  key. This function can be deactivated to save some flash.
107
108config SHELL_ASCII_FILTER
109	bool "Filter incoming ASCII characters"
110	default y
111	help
112	  Shell will not collect characters that are not in
113	  ASCII range: <0, 127>. As a result filtered characters will not be
114	  printed on the terminal and passed to the command handler.
115
116config SHELL_WILDCARD
117	bool "Wildcard support in shell"
118	select FNMATCH
119	default y if !SHELL_MINIMAL
120	help
121	  Enables using wildcards: * and ? in the shell.
122
123config SHELL_ECHO_STATUS
124	bool "Echo on shell"
125	default y
126	help
127	  If enabled shell prints back every input byte.
128
129config SHELL_START_OBSCURED
130	bool "Display asterisk when echoing"
131	help
132	  If enabled, don't echo actual character, but echo * instead.
133	  This is used for login prompts.
134
135config SHELL_VT100_COMMANDS
136	bool "VT100 commands in shell"
137	default y if !SHELL_BACKEND_RTT
138	help
139	  Enables VT100 commands in shell (e.g. cursor position, clear screen etc.).
140
141config SHELL_VT100_COLORS
142	bool "Colors in shell"
143	depends on SHELL_VT100_COMMANDS
144	default y if !SHELL_MINIMAL
145	help
146	  If enabled VT100 colors are used in shell (e.g. print errors in red).
147
148config SHELL_GETOPT
149	bool "Threadsafe getopt support in shell"
150	select GETOPT
151	help
152	  This config creates a separate getopt_state for the shell instance.
153	  It ensures that using getopt with shell is thread safe.
154	  When more threads are using getopt please call getopt_state_get to
155	  get getopt state of the shell thread.
156
157config SHELL_METAKEYS
158	bool "Metakeys"
159	default y if !SHELL_MINIMAL
160	help
161	  Enables shell meta keys: Ctrl+a, Ctrl+b, Ctrl+c, Ctrl+d, Ctrl+e,
162	  Ctrl+f, Ctrl+k, Ctrl+l, Ctrl+u, Ctrl+w, Alt+b, Alt+f
163	  Meta keys will not be active when shell echo is set to off.
164
165config SHELL_HELP
166	bool "Help message"
167	default y if !SHELL_MINIMAL
168	help
169	  Enables shell functions for printing formatted help message.
170
171config SHELL_HELP_OPT_PARSE
172	bool "Parse -h and --help options"
173	depends on SHELL_HELP
174	depends on !SHELL_GETOPT
175	default y
176	help
177	  Shell parses command to find '-h' or '--help' string. If the shell
178	  finds the string, it will automatically print a help message
179	  for a command.
180
181config SHELL_HELP_ON_WRONG_ARGUMENT_COUNT
182	bool "Printing help on wrong argument count"
183	depends on SHELL_HELP
184	default y if !SHELL_MINIMAL
185
186config SHELL_HISTORY
187	bool "History in shell"
188	default y if !SHELL_MINIMAL
189	select RING_BUFFER
190	help
191	  Enable commands history. History can be accessed using up and down
192	  arrows or Ctrl+n and Ctrl+p meta keys.
193
194config SHELL_HISTORY_BUFFER
195	int "History buffer in bytes"
196	default 128 if SHELL_MINIMAL
197	default 512
198	depends on SHELL_HISTORY
199	help
200	  Number of bytes dedicated for storing executed commands.
201
202config SHELL_STATS
203	bool "Shell statistics"
204	default y if !SHELL_MINIMAL
205
206config SHELL_CMDS
207	bool "Built-in commands"
208	default y if !SHELL_MINIMAL
209	help
210	  Enable built-in commands like 'clear', 'history', etc.
211
212config SHELL_CMDS_RESIZE
213	bool "Resize command"
214	depends on SHELL_CMDS
215	depends on SHELL_VT100_COMMANDS
216	default y if !SHELL_MINIMAL
217	help
218	  By default shell assumes width of a terminal screen set to 80
219	  characters. Each time terminal screen width is changed resize command
220	  must be called to ensure correct text display on the terminal screen.
221	  The resize command can be turned off to save code memory (~0,5k).
222
223config SHELL_CMDS_SELECT
224	bool "Select command"
225	depends on SHELL_CMDS
226	help
227	  This option enables select command. It can be used to set new root
228	  command. Exit to main command tree is with alt+r.
229
230config SHELL_CMD_ROOT
231	string "Set a root command at init"
232	help
233	  This option sets a root command at shell init,
234	  and when exiting to main command tree with alt+r.
235
236config SHELL_LOG_BACKEND
237	bool "Shell log backend"
238	depends on LOG && !LOG_MODE_MINIMAL
239	select MPSC_PBUF
240	select LOG_OUTPUT
241	default y if LOG
242	help
243	  When enabled, backend will use the shell for logging.
244	  This option is enabled by default.
245	  Disabling this option disables log output to all shell backends.
246	  Disabling log output to a specific shell backend can be achieved
247	  using the shell backend's LOG_LEVEL option
248	  (e.g. CONFIG_SHELL_TELNET_INIT_LOG_LEVEL_NONE=y).
249
250config SHELL_LOG_FORMAT_TIMESTAMP
251	bool "Format timestamp"
252	default y
253	depends on SHELL_LOG_BACKEND
254	help
255	  Enable timestamp formatting.
256
257config SHELL_AUTOSTART
258	bool "Auto-start shell at boot"
259	default y
260	help
261	  If enabled, shell will be automatically started.
262
263config SHELL_CMDS_RETURN_VALUE
264	bool "Retval command"
265	depends on SHELL_CMDS
266	default y
267	help
268	  This option enables the retval command. It is used to retrieve
269	  the return value from the most recently executed command.
270
271source "subsys/shell/modules/Kconfig"
272
273endif # SHELL
274