Skip to content
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

Shell: provide mechanism to call any command while in select command #24217

Closed
nordic-krch opened this issue Apr 9, 2020 · 3 comments
Closed
Labels
area: Shell Shell subsystem Enhancement Changes/Updates/Additions to existing features

Comments

@nordic-krch
Copy link
Contributor

Is your enhancement proposal related to a problem? Please describe.
Issue raised by @stig-bjorlykke: #24138 (comment)
A user would like to select a command (in that particular example it is AT modem commands) but still use all shell commands available in the system.

Describe potential solutions
@stig-bjorlykke proposed a default handler which is called when no command match is found. The default handler would be the one from selected command. However, imo this is not generic enough since that opens door for conflicts if selected command accepts strings which match registered commands.

Another option is to use some kind of user defined escaping which when used as prefix opens access to all set of commands despite being in select mode (e.g. shell as escape code and shell log status to envoke log command). Escape string would be user defined to prevent conflicts.

Last alternative is see is to do nothing and stay where we are. alt+r terminates selection. Maybe add shortcut to suspend selection for next command or one to resume?

@nordic-krch nordic-krch added Enhancement Changes/Updates/Additions to existing features area: Shell Shell subsystem labels Apr 9, 2020
@jakub-uC
Copy link
Contributor

jakub-uC commented Apr 9, 2020

Maybe if command starts with a special character, not allowed in the command syntax, it would indicate that we want to access the root commands tree? This should be feasible for implementation.

For example:
selected_cmd_tree_cmd argument1 argument2
Calling root command despite other command is selected:
! shell colors off or ~ shell colors off or something similar.

@stig-bjorlykke
Copy link
Contributor

From the implementation it looks like select is solving a different use case than originally requested. The use case for AT commands is to register a shell command handler which will be called instead of printing the text "command not found". This will not conflict with any other registered commands, and will allow the given command handler to determine if it can make use of the command or not. Doing this will coexist with all other shell commands.

In the AT use case the "default" command handler will reject everything not starting with AT+ or AT%, and when rejected this should give "command not found". I think using select for this is overengineering.

Having to use a different prefix for regular shell commands, or enter and exit a special mode, will not really solve the use case.

@jakub-uC
Copy link
Contributor

Fixed by #24138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Shell Shell subsystem Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

3 participants