mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Refactor
This commit is contained in:
parent
f3b5dcf125
commit
bedd5332dd
2 changed files with 6 additions and 11 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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") } }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue