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:
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user