Initial requirements
The Wsh-Shell module must satisfy two main categories of requirements:
User Requirements (focused on usability) and Development Requirements (focused on integration and maintainability).
User Requirements
-
Command Flags Support
- Support both long (
--long-option) and short (-s) flag names. - Commands follow the standard syntax
- Long flags may exist without a corresponding short form.
- Support both long (
-
Command Auto-Completion
- Pressing Tab should auto-complete the current command or suggest possible completions.
-
Command History
- Store history of executed commands.
- Navigation: ↑ to recall the previous command, ↓ to recall the next one.
-
Line Editing & Cursor Movement
- Move the cursor within the input line using ← and → keys.
- Support in-place character insertion and deletion using Backspace.
-
Hotkey Combinations
- Recognize and handle standard key combinations (e.g., Ctrl + C, Ctrl + D).
-
User Authorization
- Require user login with a password before executing commands.
-
Interface Switching
- Allow switching between hardware interfaces (e.g., USB, UART) without reflashing the firmware.
-
Sub-Shell Support
- Enable running a separate shell instance in a dedicated thread for interacting with external devices.
-
Cross-Platform Operation
- Run on various platforms without modification.
-
Multiple Hardware Interfaces
- Support different hardware I/O backends (USB, UART, etc.) transparently.
Development Requirements
-
Single Include Entry Point
- Only one header file is required to integrate Wsh-Shell into a project.
-
Modular Command Registration
- Developers can define and register module-specific commands directly within their module.
-
Configurable Portability
- Cross-platform compatibility is achieved via a dedicated configuration file.
-
Git Submodule Integration
- Wsh-Shell should be easy to integrate into any project as a Git submodule.
-
Dedicated Sub-Shell Task
- In RTOS-based systems, run sub-Shell routines in a separate FreeRTOS task.
-
Hot-Swappable Interfaces
- Switching between hardware interfaces must be possible at runtime.
-
Feature Modularity
- Features such as history, autocomplete, and authorization must be implemented as independent submodules that can be disabled without breaking the core functionality.
-
Mandatory Authorization
- Authorization is always required except in debug builds.
-
Clear Input Parsing Model
- Input parsing should follow a clearly defined state machine.
-
Sub-Shell I/O Redirection
- When launching a sub-Shell, redirect input/output processing to the child shell instance.
-
Hotkey & Combination Parsing
- Ability to detect and handle hotkey sequences and special symbol combinations.
Why not microrl / tinysh / linenoise?
Notes
- The above requirements define both what the user sees and how the developer integrates the Wsh-Shell.
- Future improvements might include scripting support, persistent command history storage, and remote shell capability.