This commit is contained in:
sxyazi 2025-01-11 09:56:18 +08:00
parent f3b5dcf125
commit bedd5332dd
No known key found for this signature in database
2 changed files with 6 additions and 11 deletions

View file

@ -1,19 +1,17 @@
use yazi_shared::event::CmdCow;
use crate::{manager::Manager, tasks::Tasks, manager::commands::quit};
use crate::{manager::{Manager, commands::quit}, tasks::Tasks};
#[derive(Default)]
struct Opt {
no_cwd_file: bool,
}
impl From<()> for Opt {
fn from(_: ()) -> Self { Self::default() }
}
impl From<CmdCow> for Opt {
fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } }
}
impl From<Opt> for quit::Opt {
fn from(value: Opt) -> Self { Self { no_cwd_file: value.no_cwd_file } }
}
impl Manager {
#[yazi_codegen::command]
@ -21,6 +19,6 @@ impl Manager {
if self.tabs.len() > 1 {
return self.tabs.close(self.tabs.cursor);
}
self.quit(quit::Opt{ no_cwd_file: opt.no_cwd_file }, tasks);
self.quit(opt, tasks);
}
}

View file

@ -9,12 +9,9 @@ use yazi_shared::event::{CmdCow, EventQuit};
use crate::{manager::Manager, tasks::Tasks};
#[derive(Default)]
pub struct Opt {
pub(super) struct Opt {
pub no_cwd_file: bool,
}
impl From<()> for Opt {
fn from(_: ()) -> Self { Self::default() }
}
impl From<CmdCow> for Opt {
fn from(c: CmdCow) -> Self { Self { no_cwd_file: c.bool("no-cwd-file") } }
}