mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
33 lines
732 B
Rust
33 lines
732 B
Rust
use std::borrow::Cow;
|
|
|
|
use yazi_config::plugin::Fetcher;
|
|
use yazi_runner::fetcher::FetchJob;
|
|
use yazi_shared::Id;
|
|
|
|
use crate::{TaskIn, fetch::FetchProg};
|
|
|
|
#[derive(Debug)]
|
|
pub(crate) struct FetchIn {
|
|
pub(crate) id: Id,
|
|
pub(crate) plugin: &'static Fetcher,
|
|
pub(crate) targets: Vec<yazi_fs::File>,
|
|
}
|
|
|
|
impl TaskIn for FetchIn {
|
|
type Prog = FetchProg;
|
|
|
|
fn id(&self) -> Id { self.id }
|
|
|
|
fn set_id(&mut self, id: Id) -> &mut Self {
|
|
self.id = id;
|
|
self
|
|
}
|
|
|
|
fn title(&self) -> Cow<'_, str> {
|
|
format!("Run fetcher '{}' with {} target(s)", self.plugin.run.name, self.targets.len()).into()
|
|
}
|
|
}
|
|
|
|
impl From<FetchIn> for FetchJob {
|
|
fn from(value: FetchIn) -> Self { Self { action: &value.plugin.run, files: value.targets } }
|
|
}
|