Commit graph

12 commits

Author SHA1 Message Date
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Krzysztof Chruscinski 1fb61ea01e shell: Move default terminal width and height to Kconfig
Default values were fixed in the code. Moved to Kconfig to allow
customized configuration. Custom configuration may be used to prevent
line breaking injected on terminal width.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-13 11:28:41 +02:00
Krzysztof Chruscinski 512de5ecac shell: Refactor command execution to enable raw arguments
Added special flag that can be used to indicate that optional
arguments are passed without any parsing (e.g. quotation marks
removal). Modified execute command to parse command line buffer
argument by argument.

After this change it is possible to forward whole command to
command handler (using select).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-05-07 23:47:39 -05:00
Krzysztof Chruscinski 53b5bae41b shell: Refactor command getters
Refactor and simplified fetching commands from the tree
of commands.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-04-23 18:30:41 +02:00
Jakub Rzeszutko b633e431a4 shell: add select command
The "select" command has been implemented, which allows user to
narrow down the command tree.

This implementation differs from the "select" command available
in the legacy shell. In a new implementation, if the selected
command has a handler and if the user has not entered the
registered subcommand, the shell will call the handler of selected
command and pass the text as arguments.

This may be useful, for example, if someone wants to use the
shell as an interface to a modem that supports AT commands.
Instead of each time you write e.g:
	at at+command1
	at at+command2
	at at+command3
user can execute following commands:
	select at
	at+command1
	at+command2
	at+command3

where:
at - root command for passing at commands to the modem
at+commandX - at command passed to the modem.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-05-24 11:04:42 +02:00
Jakub Rzeszutko 2f040d8188 shell: unify commands execution
This change removes special handling for shell root commands.
Currently there is one loop in execute function that is used
to search commands on each level.

Fixed a bug where command buffer has been processed twice
when it was not needed (wildcards not found).

This change will allow to simplify "select" command
introduction.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2019-02-08 14:58:44 -05:00
Flavio Ceolin 80c03550ba shell: Make shell_strlen return u16_t
Everywhere the return of this function was being assigned to u16_t to
save space on stack. Instead of casting in all these places (and may
end up with overflow), just changing this function's return.

Note that the function itself is not checking for overflow yet since
I'm not sure this can happen and/or is a problem. Though now we have
only one single point to fix this problem.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-12-28 17:47:46 -05:00
Jakub Rzeszutko f7f4fe33a1 shell: static functions cleanup
Removed shell_ prefix from static functions in .c files.
Added static functions for setting and getting shell
internal flags.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-17 11:31:22 +01:00
Jakub Rzeszutko 4d491b283b shell: remove obsolete \r characters
shell parses output string and it adds \r for each found \n.
It is no longer needed to keep \r for each shell message.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-17 11:31:22 +01:00
Jakub Rzeszutko 3064ca4f2f shell: creating new module for help functionality
1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Flavio Ceolin 713ec4c71c shell: utils: Remove dead code
Coverity-CID: 188741

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-11-30 08:06:40 -08:00
Krzysztof Chruscinski 6aed72e487 shell: Shell subsystem reimplementation
New shell support features like:
- multi-instance
- command tree
- static and dynamic commands
- multiline
- help print function
- smart tab (autocompletion)
- meta-keys
- history, wildcards etc.
- generic transport (initially, uart present)

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-09-19 09:30:29 -04:00