Expand description
Command driver for reovim - command execution framework.
Linux equivalent: drivers/block/ (block command interface)
§Architecture
This crate defines the command execution framework for reovim.
Commands implement Command for metadata and CommandHandler for execution.
server/lib/drivers/command/ <-- Command framework (this crate)
^
| (modules implement commands)
|
server/modules/ <-- Policy: actual command implementations§Components
Command- Self-describing command metadataCommandHandler- Command execution traitArgSpec- Argument specificationArgKind,ArgValue- Argument typesCommandContext- Context carrying all command inputsCommandResult- Command execution result
§Example
ⓘ
use reovim_driver_command::{Command, CommandHandler, CommandContext, CommandResult, ArgSpec, ArgKind};
use reovim_driver_session::SessionRuntime;
use reovim_kernel::api::v1::{CommandId, ModuleId};
const MY_MODULE: ModuleId = ModuleId::new_const("my-module");
pub struct CursorDown;
impl Command for CursorDown {
fn id(&self) -> CommandId {
CommandId::new(MY_MODULE, "cursor-down")
}
fn description(&self) -> &'static str {
"Move cursor down"
}
fn args(&self) -> Vec<ArgSpec> {
vec![ArgSpec::optional("count", ArgKind::Count, "Number of lines")]
}
}
impl CommandHandler for CursorDown {
fn execute(&self, runtime: &mut SessionRuntime<'_>, args: &CommandContext) -> CommandResult {
let count = args.count().unwrap_or(1);
// Move cursor down by count lines using runtime.kernel() escape hatch
// or BufferApi methods
CommandResult::Success
}
}Structs§
- Ambiguous
Prefix - Error returned when a prefix matches multiple distinct commands.
- ArgSpec
- Argument specification for self-describing commands.
- Command
Context - Context carrying all command inputs.
- Command
Handler Store - Store for command handlers registered by modules.
- Command
Info - Command metadata for queries (no execution capability).
- Command
Name Index - Name-based command index for ex-command resolution.
- Command
Query Provider - Concrete service for module-level command discovery.
- Parsed
Cmdline - Parsed command-line input.
Enums§
- ArgError
- Error type for argument binding failures.
- ArgKind
- The kind of argument a command accepts.
- ArgValue
- Argument value parsed from user input.
- Command
Priority - Priority level for command registration (#545).
- Command
Result - Result of command execution.
- Motion
Type - Motion type classification.
- Runtime
Signal - Per-client lifecycle signal.
Traits§
- Command
- Self-describing command metadata.
- Command
Handler - Command execution trait.
- Command
Provider - Trait for modules that provide command handlers.
- Command
Query Service - Query service for command discovery and completion.
Functions§
- bind_
args - Bind arguments to specs, producing a map of name -> value.
- parse_
cmdline - Parse a command-line string into name, bang, and args.
- tokenize_
args - Tokenize argument text with quote and escape awareness.