mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
25 lines
436 B
Rust
25 lines
436 B
Rust
use yazi_shared::{event::CmdCow, url::Url};
|
|
|
|
use crate::mgr::Mgr;
|
|
|
|
pub struct Opt {
|
|
urls: Vec<Url>,
|
|
}
|
|
|
|
impl TryFrom<CmdCow> for Opt {
|
|
type Error = ();
|
|
|
|
fn try_from(mut c: CmdCow) -> Result<Self, Self::Error> {
|
|
Ok(Self { urls: c.take_any("urls").ok_or(())? })
|
|
}
|
|
}
|
|
|
|
impl Mgr {
|
|
pub fn update_tasks(&mut self, opt: impl TryInto<Opt>) {
|
|
let Ok(opt) = opt.try_into() else {
|
|
return;
|
|
};
|
|
|
|
self.watcher.push_files(opt.urls);
|
|
}
|
|
}
|