-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New "readline" module for a better shell #2751
Conversation
static char cut_buffer[SHELL_BUFFER_SIZE]; | ||
|
||
// TODO: Introduce definition PROMT_LENGTH (instead of "2") | ||
#define PROMT_LENGTH 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is meant to be PROMPT_LENGTH
To be clear: this is a native only feature right? |
Because as a far as I know: pyterm provides most of this already. |
Does RIOT really need to provide terminal features? |
@authmillenon No this feature is independent of the port, just as the @Kijewski This is not needed at all, but I found it nice to have. Pyterm is just one of many terminal programs, I'm sure different people have different favours and different use cases may also require different terminals. For that matter, terminal features may be of interest. |
please add module prefixes to the commits. |
Haven't had time to look into the "why" yet, but the PR currently bumps the RAM usage on the SAMR21 by 512 bytes when not including the readline module and by 648 bytes when including it. |
Needs rebase |
@LudwigOrtmann I will add prefixes, what is the syntax for it? " |
@noshky if you build for the SAMR with
It will display the size of the different sections in the binary at the end. The section you're interested in for RAM usage is |
…tion. The color output can be enabled by setting USE_SHELL_COLORS=1. Also added an example of color usage to the shell-test app.
The module contains: - Recognition of VT102/ANSI compatible control characters. - Bash/zsh compatible keyboard shortcuts for line edditing. - A space-efficient history implementation, configurable in size and enablement (SHELL_HISTORY_SIZE=n). - A shell-command handler to print the READLINE-module keyboard shortcuts. This shell implementation will depend on the curses/ncurses library for the native port.
…is needed for the shell/readline implementation. The usage of ncurses is needed to configure the terminal/shell, in which native applications are run. This adds the usage of the LIBNCURSES and LIBTINFO to the native port. The ncurses initialization and de-initialization is done in the native-uart0 startup handlers. To enable the proper restart of native terminal-apps, the ENV variable is stored and re-used upon restart.
The readline-implementation is only used when the module is activated, otherwise the regular implementation is used.
@noshky seems you figured this out on your own =) |
Found another use-case for this module: iotlab-term doesn't use pyterm either and is would also benefit, I guess. @OlegHahm what do you think? |
You can easily use pyterm with IoT-LAB and the serial-aggregator also uses readline. |
How? I'm having problems accessing the history. |
That's probably an ssh issue. Try with #2952 |
I think it would be a nice feature for toying around, but not really enhance RIOT handling, but just increase memory usage. Since original contributor seems to have abandoned this anyway, I think we can close this. |
This is a more sophisticated shell implementation, that has colors, cursor-navigation, bash/zsh-like shortcuts and even a history (no tab-completion yet).
The implementation can be integrated as a module via
USEMODULE += readline
. The dependency to theshell
-module is provided.The shell module can now be configured with
USE_SHELL_COLORS=1
to have fancy colors.The readline module can be configured with
SHELL_HISTORY_SIZE=<n>
to have a history-buffer that is n-times the buffer size.SHELL_HISTORY_SIZE=0
compiles without the usage of the history, as well as not mentioning that flag at all.TODOs:
The SHELL_BUFFER_SIZE has a big FIXME written next to it in
readline.h
. It should be of the same size as the buffer size used for theshell
module, but i haven't figured a way out yet to combine them.