mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
26 lines
471 B
Rust
26 lines
471 B
Rust
use yazi_shared::{event::Cmd, render};
|
|
|
|
use crate::confirm::Confirm;
|
|
|
|
pub struct Opt {
|
|
submit: bool,
|
|
}
|
|
|
|
impl From<Cmd> for Opt {
|
|
fn from(c: Cmd) -> Self { Self { submit: c.bool("submit") } }
|
|
}
|
|
impl From<bool> for Opt {
|
|
fn from(submit: bool) -> Self { Self { submit } }
|
|
}
|
|
|
|
impl Confirm {
|
|
#[yazi_codegen::command]
|
|
pub fn close(&mut self, opt: Opt) {
|
|
if let Some(cb) = self.callback.take() {
|
|
_ = cb.send(opt.submit);
|
|
}
|
|
|
|
self.visible = false;
|
|
render!();
|
|
}
|
|
}
|