mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
23 lines
453 B
Rust
23 lines
453 B
Rust
use yazi_shared::event::Cmd;
|
|
|
|
use crate::{manager::Manager, tasks::Tasks};
|
|
|
|
pub struct Opt {
|
|
relative: bool,
|
|
force: bool,
|
|
}
|
|
|
|
impl From<Cmd> for Opt {
|
|
fn from(c: Cmd) -> Self { Self { relative: c.bool("relative"), force: c.bool("force") } }
|
|
}
|
|
|
|
impl Manager {
|
|
#[yazi_macro::command]
|
|
pub fn link(&mut self, opt: Opt, tasks: &Tasks) {
|
|
if self.yanked.cut {
|
|
return;
|
|
}
|
|
|
|
tasks.file_link(&self.yanked, self.cwd(), opt.relative, opt.force);
|
|
}
|
|
}
|