mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
25 lines
466 B
Rust
25 lines
466 B
Rust
use anyhow::Result;
|
|
use yazi_macro::succ;
|
|
use yazi_parser::mgr::LinkForm;
|
|
use yazi_shared::data::Data;
|
|
|
|
use crate::{Actor, Ctx};
|
|
|
|
pub struct Link;
|
|
|
|
impl Actor for Link {
|
|
type Form = LinkForm;
|
|
|
|
const NAME: &str = "link";
|
|
|
|
fn act(cx: &mut Ctx, form: Self::Form) -> 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(), form.relative, form.force);
|
|
}
|
|
|
|
succ!();
|
|
}
|
|
}
|