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_DEVICE_HELPERS
29	bool "Shell device helpers"
30	imply DEVICE_DT_METADATA
31	default y if !SHELL_MINIMAL
32
33config SHELL_THREAD_PRIORITY_OVERRIDE
34	bool "Override default shell thread priority"
35	help
36	  Option to change the default value of shell thread priority.
37
38if SHELL_THREAD_PRIORITY_OVERRIDE
39config SHELL_THREAD_PRIORITY
40	int "Shell thread priority"
41	default 0
42	help
43	  Set thread priority of the shell
44endif
45
46config SHELL_STACK_SIZE
47	int "Shell thread stack size"
48	default 3168 if OPENTHREAD_SHELL
49	default 3072 if 64BIT
50	default 2048 if MULTITHREADING
51	default 0 if !MULTITHREADING
52	help
53	  Stack size for thread created for each instance.
54
55config SHELL_BACKSPACE_MODE_DELETE
56	bool "Default escape code for backspace is DELETE (0x7F)"
57	default y
58	help
59	  Terminals have different escape code settings for backspace button.
60	  Some terminals send code: 0x08 (backspace) other 0x7F (delete). When
61	  this option is set shell will expect 0x7F for backspace key.
62
63config SHELL_PROMPT_CHANGE
64	bool "Allow prompt change in runtime"
65	default y if !SHELL_MINIMAL
66	help
67	  Allow for the modification of the shell prompt at runtime.
68	  Enabling this will allocate additional RAM memory where
69	  the string of the prompt will be stored.
70
71config SHELL_PROMPT_BUFF_SIZE
72	int "Shell prompt buffer size"
73	depends on SHELL_PROMPT_CHANGE
74	range 2 40
75	default 10 if SHELL_MINIMAL
76	default 20
77	help
78	  Maximum prompt size in bytes. One byte is reserved for the string
79	  terminator character.
80
81config SHELL_CMD_BUFF_SIZE
82	int "Shell command buffer size"
83	default 128 if SHELL_MINIMAL
84	default 256
85	help
86	  Maximum command size in bytes. One byte is reserved for the string
87	  terminator character.
88
89config SHELL_PRINTF_BUFF_SIZE
90	int "Shell print buffer size"
91	default 30
92	help
93	  Maximum text buffer size for fprintf function.
94	  It is working like stdio buffering in Linux systems
95	  to limit number of peripheral access calls.
96
97config SHELL_PRINTF_AUTOFLUSH
98	bool "Indicate if the buffer should be automatically flushed"
99	default y
100	help
101	  Specify whether the shell's printing functions should automatically
102	  flush the printf buffer.
103
104config SHELL_DEFAULT_TERMINAL_WIDTH
105	int "Default terminal width"
106	range 1 $(UINT16_MAX)
107	default 80
108	help
109	  Default terminal width is used to break lines.
110
111config SHELL_DEFAULT_TERMINAL_HEIGHT
112	int "Default terminal height"
113	default 24
114
115config SHELL_ARGC_MAX
116	int "Maximum arguments in shell command"
117	range 3 $(UINT8_MAX)
118	default 30 if NET_L2_WIFI_SHELL
119	default 20
120	help
121	  Maximum number of arguments that can build a command.
122
123config SHELL_TAB
124	bool "The Tab button support in shell"
125	default y if !SHELL_MINIMAL
126	help
127	  Enable using the Tab button in the shell. The button
128	  can be used for prompting commands, or for autocompletion.
129	  This feature has high impact on flash usage.
130
131config SHELL_TAB_AUTOCOMPLETION
132	bool "Commands autocompletion with the Tab button"
133	depends on SHELL_TAB
134	default y if !SHELL_MINIMAL
135	help
136	  Enable commands and subcommands autocompletion with the Tab
137	  key. This function can be deactivated to save some flash.
138
139config SHELL_ASCII_FILTER
140	bool "Filter incoming ASCII characters"
141	default y
142	help
143	  Shell will not collect characters that are not in
144	  ASCII range: <0, 127>. As a result filtered characters will not be
145	  printed on the terminal and passed to the command handler.
146
147config SHELL_WILDCARD
148	bool "Wildcard support in shell"
149	select POSIX_C_LIB_EXT
150	default y if !SHELL_MINIMAL
151	help
152	  Enables using wildcards: * and ? in the shell.
153
154config SHELL_MSG_CMD_NOT_FOUND
155	bool "': command not found' message in the shell"
156	default y
157	help
158	  If enabled, the shell prints out this message.
159
160config SHELL_MSG_SPECIFY_SUBCOMMAND
161	bool "'Please specify a subcommand.' message in the shell"
162	default y
163	help
164	  If enabled, the shell prints out this message.
165
166config SHELL_ECHO_STATUS
167	bool "Echo on shell"
168	default y
169	help
170	  If enabled shell prints back every input byte.
171
172config SHELL_START_OBSCURED
173	bool "Display asterisk when echoing"
174	help
175	  If enabled, don't echo actual character, but echo * instead.
176	  This is used for login prompts.
177
178config SHELL_VT100_COMMANDS
179	bool "VT100 commands in shell"
180	default y
181	help
182	  Enables VT100 commands in shell (e.g. cursor position, clear screen etc.).
183
184config SHELL_VT100_COLORS
185	bool "Colors in shell"
186	depends on SHELL_VT100_COMMANDS
187	default y if !SHELL_MINIMAL
188	help
189	  If enabled VT100 colors are used in shell (e.g. print errors in red).
190
191config SHELL_GETOPT
192	bool "Threadsafe getopt support in shell"
193	select POSIX_C_LIB_EXT
194	help
195	  This config creates a separate getopt_state for the shell instance.
196	  It ensures that using getopt with shell is thread safe.
197	  When more threads are using getopt please call getopt_state_get to
198	  get getopt state of the shell thread.
199
200config SHELL_METAKEYS
201	bool "Metakeys"
202	default y if !SHELL_MINIMAL
203	help
204	  Enables shell meta keys: Ctrl+a, Ctrl+b, Ctrl+c, Ctrl+d, Ctrl+e,
205	  Ctrl+f, Ctrl+k, Ctrl+l, Ctrl+u, Ctrl+w, Alt+b, Alt+f
206	  Meta keys will not be active when shell echo is set to off.
207
208config SHELL_HELP
209	bool "Help message"
210	default y if !SHELL_MINIMAL
211	help
212	  Enables shell functions for printing formatted help message.
213
214config SHELL_HELP_OPT_PARSE
215	bool "Parse -h and --help options"
216	depends on SHELL_HELP
217	depends on !SHELL_GETOPT
218	default y
219	help
220	  Shell parses command to find '-h' or '--help' string. If the shell
221	  finds the string, it will automatically print a help message
222	  for a command.
223
224config SHELL_HELP_ON_WRONG_ARGUMENT_COUNT
225	bool "Printing help on wrong argument count"
226	depends on SHELL_HELP
227	default y if !SHELL_MINIMAL
228
229config SHELL_HISTORY
230	bool "History in shell"
231	default y if !SHELL_MINIMAL
232	select RING_BUFFER
233	help
234	  Enable commands history. History can be accessed using up and down
235	  arrows or Ctrl+n and Ctrl+p meta keys.
236
237config SHELL_HISTORY_BUFFER
238	int "History buffer in bytes"
239	default 128 if SHELL_MINIMAL
240	default 512
241	depends on SHELL_HISTORY
242	help
243	  Number of bytes dedicated for storing executed commands.
244
245config SHELL_STATS
246	bool "Shell statistics"
247	default y if !SHELL_MINIMAL
248
249config SHELL_CMDS
250	bool "Built-in commands"
251	default y if !SHELL_MINIMAL
252	help
253	  Enable built-in commands like 'clear', 'history', etc.
254
255config SHELL_CMDS_RESIZE
256	bool "Resize command"
257	depends on SHELL_CMDS
258	depends on SHELL_VT100_COMMANDS
259	default y if !SHELL_MINIMAL
260	help
261	  By default shell assumes width of a terminal screen set to 80
262	  characters. Each time terminal screen width is changed resize command
263	  must be called to ensure correct text display on the terminal screen.
264	  The resize command can be turned off to save code memory (~0,5k).
265
266config SHELL_CMDS_SELECT
267	bool "Select command"
268	depends on SHELL_CMDS
269	help
270	  This option enables select command. It can be used to set new root
271	  command. Exit to main command tree is with alt+r.
272
273config SHELL_CMD_ROOT
274	string "Set a root command at init"
275	help
276	  This option sets a root command at shell init,
277	  and when exiting to main command tree with alt+r.
278
279config SHELL_LOG_BACKEND
280	bool "Shell log backend"
281	depends on LOG && !LOG_MODE_MINIMAL
282	select MPSC_PBUF
283	select LOG_OUTPUT
284	default y if LOG
285	help
286	  When enabled, backend will use the shell for logging.
287	  This option is enabled by default.
288	  Disabling this option disables log output to all shell backends.
289	  Disabling log output to a specific shell backend can be achieved
290	  using the shell backend's LOG_LEVEL option
291	  (e.g. CONFIG_SHELL_TELNET_INIT_LOG_LEVEL_NONE=y).
292
293config SHELL_LOG_BACKEND_CUSTOM
294	bool "Use custom backend implementation"
295	help
296	  When enabled, standard implementation of shell log backend is not included.
297	  It allows to provide custom implementation of multiplexing logging messages
298	  with shell data.
299
300config SHELL_LOG_FORMAT_TIMESTAMP
301	bool "Format timestamp"
302	default y
303	depends on SHELL_LOG_BACKEND
304	help
305	  Enable timestamp formatting.
306
307config SHELL_AUTOSTART
308	bool "Auto-start shell at boot"
309	default y
310	help
311	  If enabled, shell will be automatically started.
312
313config SHELL_CMDS_RETURN_VALUE
314	bool "Retval command"
315	depends on SHELL_CMDS
316	default y
317	help
318	  This option enables the retval command. It is used to retrieve
319	  the return value from the most recently executed command.
320
321config SHELL_CUSTOM_HEADER
322	bool "Include Custom Shell Header"
323	help
324	  When enabled, a custom application provided header, named
325	  "zephyr_custom_shell.h", is included at the end of shell.h. This enables
326	  extension of the shell APIs at the macro level. Please use cautiously!
327	  The internal shell API may change in future releases.
328
329source "subsys/shell/modules/Kconfig"
330
331endif # SHELL
332