diff --git a/yazi-core/src/manager/commands/close.rs b/yazi-core/src/manager/commands/close.rs index 2354b47f..3cd467ba 100644 --- a/yazi-core/src/manager/commands/close.rs +++ b/yazi-core/src/manager/commands/close.rs @@ -1,12 +1,26 @@ use yazi_shared::event::CmdCow; -use crate::{manager::Manager, tasks::Tasks}; +use crate::{manager::Manager, tasks::Tasks, manager::commands::quit}; + +#[derive(Default)] +struct Opt { + no_cwd_file: bool, +} + +impl From<()> for Opt { + fn from(_: ()) -> Self { Self::default() } +} + +impl From for Opt { + fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } } +} impl Manager { - pub fn close(&mut self, c: CmdCow, tasks: &Tasks) { + #[yazi_codegen::command] + pub fn close(&mut self, opt: Opt, tasks: &Tasks) { if self.tabs.len() > 1 { return self.tabs.close(self.tabs.cursor); } - self.quit(c, tasks); + self.quit(quit::Opt{ no_cwd_file: opt.no_cwd_file }, tasks); } } diff --git a/yazi-core/src/manager/commands/quit.rs b/yazi-core/src/manager/commands/quit.rs index 82fb6c6d..abed3141 100644 --- a/yazi-core/src/manager/commands/quit.rs +++ b/yazi-core/src/manager/commands/quit.rs @@ -9,8 +9,8 @@ use yazi_shared::event::{CmdCow, EventQuit}; use crate::{manager::Manager, tasks::Tasks}; #[derive(Default)] -struct Opt { - no_cwd_file: bool, +pub struct Opt { + pub no_cwd_file: bool, } impl From<()> for Opt { fn from(_: ()) -> Self { Self::default() }