mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
25 lines
468 B
Rust
25 lines
468 B
Rust
use anyhow::Result;
|
|
use yazi_macro::succ;
|
|
use yazi_parser::mgr::LinkOpt;
|
|
use yazi_shared::event::Data;
|
|
|
|
use crate::{Actor, Ctx};
|
|
|
|
pub struct Link;
|
|
|
|
impl Actor for Link {
|
|
type Options = LinkOpt;
|
|
|
|
const NAME: &str = "link";
|
|
|
|
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
|
let mgr = &mut cx.core.mgr;
|
|
let tab = &mgr.tabs[cx.tab];
|
|
|
|
if !mgr.yanked.cut {
|
|
cx.core.tasks.file_link(&mgr.yanked, tab.cwd(), opt.relative, opt.force);
|
|
}
|
|
|
|
succ!();
|
|
}
|
|
}
|