Skip to main content

Crate reovim_driver_command

Crate reovim_driver_command 

Source
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

§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§

AmbiguousPrefix
Error returned when a prefix matches multiple distinct commands.
ArgSpec
Argument specification for self-describing commands.
CommandContext
Context carrying all command inputs.
CommandHandlerStore
Store for command handlers registered by modules.
CommandInfo
Command metadata for queries (no execution capability).
CommandNameIndex
Name-based command index for ex-command resolution.
CommandQueryProvider
Concrete service for module-level command discovery.
ParsedCmdline
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.
CommandPriority
Priority level for command registration (#545).
CommandResult
Result of command execution.
MotionType
Motion type classification.
RuntimeSignal
Per-client lifecycle signal.

Traits§

Command
Self-describing command metadata.
CommandHandler
Command execution trait.
CommandProvider
Trait for modules that provide command handlers.
CommandQueryService
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.