diff --git a/yazi-core/src/manager/commands/close.rs b/yazi-core/src/manager/commands/close.rs index 3662cc37..568b66ea 100644 --- a/yazi-core/src/manager/commands/close.rs +++ b/yazi-core/src/manager/commands/close.rs @@ -1,12 +1,24 @@ use yazi_shared::event::CmdCow; -use crate::{manager::Manager, tasks::Tasks}; +use crate::{manager::{Manager, commands::quit}, tasks::Tasks}; + +#[derive(Default)] +struct Opt { + no_cwd_file: bool, +} +impl From for Opt { + fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } } +} +impl From for quit::Opt { + fn from(value: Opt) -> Self { Self { no_cwd_file: value.no_cwd_file } } +} impl Manager { - pub fn close(&mut self, _: 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((), tasks); + self.quit(opt, tasks); } } diff --git a/yazi-core/src/manager/commands/quit.rs b/yazi-core/src/manager/commands/quit.rs index 82fb6c6d..d1ea9288 100644 --- a/yazi-core/src/manager/commands/quit.rs +++ b/yazi-core/src/manager/commands/quit.rs @@ -9,11 +9,8 @@ use yazi_shared::event::{CmdCow, EventQuit}; use crate::{manager::Manager, tasks::Tasks}; #[derive(Default)] -struct Opt { - no_cwd_file: bool, -} -impl From<()> for Opt { - fn from(_: ()) -> Self { Self::default() } +pub(super) struct Opt { + pub(super) no_cwd_file: bool, } impl From for Opt { fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } }