refactor(command): remove old Command enum and dispatch system

Remove the old JSON-based command infrastructure:

- Delete Command enum and CommandResult from types.rs
- Remove QuitCmd and InitBuffer command implementations
- Delete entire dispatch.rs file that handled command execution
- Remove Command type exports from mod.rs

The old system used a monolithic Command enum with serde serialization.
The new trait-based system is more flexible and doesn't require JSON
serialization for command execution.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
This commit is contained in:
Edward Langley
2026-04-04 10:56:35 -07:00
parent 1e8bc7a135
commit 909c20bcbd
3 changed files with 0 additions and 419 deletions

View File

@ -238,23 +238,6 @@ impl Cmd for EnterMode {
}
}
#[derive(Debug)]
pub struct QuitCmd;
impl Cmd for QuitCmd {
fn name(&self) -> &str {
"quit"
}
fn execute(&self, ctx: &CmdContext) -> Vec<Box<dyn Effect>> {
if ctx.dirty {
vec![effect::set_status(
"Unsaved changes! Use :wq to save+quit or :q! to force quit",
)]
} else {
vec![effect::change_mode(AppMode::Quit)]
}
}
}
#[derive(Debug)]
pub struct ForceQuit;
impl Cmd for ForceQuit {
@ -1364,28 +1347,6 @@ impl Cmd for PopChar {
}
}
/// Initialize a named buffer (set it to a value) and change mode.
#[derive(Debug)]
pub struct InitBuffer {
pub buffer: String,
pub value: String,
pub mode: AppMode,
}
impl Cmd for InitBuffer {
fn name(&self) -> &str {
"init-buffer"
}
fn execute(&self, _ctx: &CmdContext) -> Vec<Box<dyn Effect>> {
vec![
Box::new(effect::SetBuffer {
name: self.buffer.clone(),
value: self.value.clone(),
}),
effect::change_mode(self.mode.clone()),
]
}
}
// ── Commit commands (mode-specific buffer consumers) ────────────────────────
/// Commit a cell edit: parse buffer, set cell, advance cursor, return to Normal.