yazi-proxy 0.2.4

Yazi event proxy
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use tokio::sync::oneshot;
use yazi_config::popup::SelectCfg;
use yazi_shared::{emit, event::Cmd, term::Term, Layer};

use crate::options::SelectOpt;

pub struct SelectProxy;

impl SelectProxy {
	#[inline]
	pub async fn show(cfg: SelectCfg) -> anyhow::Result<usize> {
		let (tx, rx) = oneshot::channel();
		emit!(Call(Cmd::new("show").with_data(SelectOpt { cfg, tx }), Layer::Select));
		rx.await.unwrap_or_else(|_| Term::goodbye(|| false))
	}
}