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_DEFAULT_TERMINAL_WIDTH
98	int "Default terminal width"
99	range 1 $(UINT16_MAX)
100	default 80
101	help
102	  Default terminal width is used to break lines.
103
104config SHELL_DEFAULT_TERMINAL_HEIGHT
105	int "Default terminal height"
106	default 24
107
108config SHELL_ARGC_MAX
109	int "Maximum arguments in shell command"
110	range 3 $(UINT8_MAX)
111	default 20
112	help
113	  Maximum number of arguments that can build a command.
114
115config SHELL_TAB
116	bool "The Tab button support in shell"
117	default y if !SHELL_MINIMAL
118	help
119	  Enable using the Tab button in the shell. The button
120	  can be used for prompting commands, or for autocompletion.
121	  This feature has high impact on flash usage.
122
123config SHELL_TAB_AUTOCOMPLETION
124	bool "Commands autocompletion with the Tab button"
125	depends on SHELL_TAB
126	default y if !SHELL_MINIMAL
127	help
128	  Enable commands and subcommands autocompletion with the Tab
129	  key. This function can be deactivated to save some flash.
130
131config SHELL_ASCII_FILTER
132	bool "Filter incoming ASCII characters"
133	default y
134	help
135	  Shell will not collect characters that are not in
136	  ASCII range: <0, 127>. As a result filtered characters will not be
137	  printed on the terminal and passed to the command handler.
138
139config SHELL_WILDCARD
140	bool "Wildcard support in shell"
141	select POSIX_C_LIB_EXT
142	default y if !SHELL_MINIMAL
143	help
144	  Enables using wildcards: * and ? in the shell.
145
146config SHELL_MSG_CMD_NOT_FOUND
147	bool "': command not found' message in the shell"
148	default y
149	help
150	  If enabled, the shell prints out this message.
151
152config SHELL_MSG_SPECIFY_SUBCOMMAND
153	bool "'Please specify a subcommand.' message in the shell"
154	default y
155	help
156	  If enabled, the shell prints out this message.
157
158config SHELL_ECHO_STATUS
159	bool "Echo on shell"
160	default y
161	help
162	  If enabled shell prints back every input byte.
163
164config SHELL_START_OBSCURED
165	bool "Display asterisk when echoing"
166	help
167	  If enabled, don't echo actual character, but echo * instead.
168	  This is used for login prompts.
169
170config SHELL_VT100_COMMANDS
171	bool "VT100 commands in shell"
172	default y
173	help
174	  Enables VT100 commands in shell (e.g. cursor position, clear screen etc.).
175
176config SHELL_VT100_COLORS
177	bool "Colors in shell"
178	depends on SHELL_VT100_COMMANDS
179	default y if !SHELL_MINIMAL
180	help
181	  If enabled VT100 colors are used in shell (e.g. print errors in red).
182
183config SHELL_GETOPT
184	bool "Threadsafe getopt support in shell"
185	select POSIX_C_LIB_EXT
186	help
187	  This config creates a separate getopt_state for the shell instance.
188	  It ensures that using getopt with shell is thread safe.
189	  When more threads are using getopt please call getopt_state_get to
190	  get getopt state of the shell thread.
191
192config SHELL_METAKEYS
193	bool "Metakeys"
194	default y if !SHELL_MINIMAL
195	help
196	  Enables shell meta keys: Ctrl+a, Ctrl+b, Ctrl+c, Ctrl+d, Ctrl+e,
197	  Ctrl+f, Ctrl+k, Ctrl+l, Ctrl+u, Ctrl+w, Alt+b, Alt+f
198	  Meta keys will not be active when shell echo is set to off.
199
200config SHELL_HELP
201	bool "Help message"
202	default y if !SHELL_MINIMAL
203	help
204	  Enables shell functions for printing formatted help message.
205
206config SHELL_HELP_OPT_PARSE
207	bool "Parse -h and --help options"
208	depends on SHELL_HELP
209	depends on !SHELL_GETOPT
210	default y
211	help
212	  Shell parses command to find '-h' or '--help' string. If the shell
213	  finds the string, it will automatically print a help message
214	  for a command.
215
216config SHELL_HELP_ON_WRONG_ARGUMENT_COUNT
217	bool "Printing help on wrong argument count"
218	depends on SHELL_HELP
219	default y if !SHELL_MINIMAL
220
221config SHELL_HISTORY
222	bool "History in shell"
223	default y if !SHELL_MINIMAL
224	select RING_BUFFER
225	help
226	  Enable commands history. History can be accessed using up and down
227	  arrows or Ctrl+n and Ctrl+p meta keys.
228
229config SHELL_HISTORY_BUFFER
230	int "History buffer in bytes"
231	default 128 if SHELL_MINIMAL
232	default 512
233	depends on SHELL_HISTORY
234	help
235	  Number of bytes dedicated for storing executed commands.
236
237config SHELL_STATS
238	bool "Shell statistics"
239	default y if !SHELL_MINIMAL
240
241config SHELL_CMDS
242	bool "Built-in commands"
243	default y if !SHELL_MINIMAL
244	help
245	  Enable built-in commands like 'clear', 'history', etc.
246
247config SHELL_CMDS_RESIZE
248	bool "Resize command"
249	depends on SHELL_CMDS
250	depends on SHELL_VT100_COMMANDS
251	default y if !SHELL_MINIMAL
252	help
253	  By default shell assumes width of a terminal screen set to 80
254	  characters. Each time terminal screen width is changed resize command
255	  must be called to ensure correct text display on the terminal screen.
256	  The resize command can be turned off to save code memory (~0,5k).
257
258config SHELL_CMDS_SELECT
259	bool "Select command"
260	depends on SHELL_CMDS
261	help
262	  This option enables select command. It can be used to set new root
263	  command. Exit to main command tree is with alt+r.
264
265config SHELL_CMD_ROOT
266	string "Set a root command at init"
267	help
268	  This option sets a root command at shell init,
269	  and when exiting to main command tree with alt+r.
270
271config SHELL_LOG_BACKEND
272	bool "Shell log backend"
273	depends on LOG && !LOG_MODE_MINIMAL
274	select MPSC_PBUF
275	select LOG_OUTPUT
276	default y if LOG
277	help
278	  When enabled, backend will use the shell for logging.
279	  This option is enabled by default.
280	  Disabling this option disables log output to all shell backends.
281	  Disabling log output to a specific shell backend can be achieved
282	  using the shell backend's LOG_LEVEL option
283	  (e.g. CONFIG_SHELL_TELNET_INIT_LOG_LEVEL_NONE=y).
284
285config SHELL_LOG_BACKEND_CUSTOM
286	bool "Use custom backend implementation"
287	help
288	  When enabled, standard implementation of shell log backend is not included.
289	  It allows to provide custom implementation of multiplexing logging messages
290	  with shell data.
291
292config SHELL_LOG_FORMAT_TIMESTAMP
293	bool "Format timestamp"
294	default y
295	depends on SHELL_LOG_BACKEND
296	help
297	  Enable timestamp formatting.
298
299config SHELL_AUTOSTART
300	bool "Auto-start shell at boot"
301	default y
302	help
303	  If enabled, shell will be automatically started.
304
305config SHELL_CMDS_RETURN_VALUE
306	bool "Retval command"
307	depends on SHELL_CMDS
308	default y
309	help
310	  This option enables the retval command. It is used to retrieve
311	  the return value from the most recently executed command.
312
313config SHELL_CUSTOM_HEADER
314	bool "Include Custom Shell Header"
315	help
316	  When enabled, a custom application provided header, named
317	  "zephyr_custom_shell.h", is included at the end of shell.h. This enables
318	  extension of the shell APIs at the macro level. Please use cautiously!
319	  The internal shell API may change in future releases.
320
321source "subsys/shell/modules/Kconfig"
322
323endif # SHELL
324