mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
22 lines
409 B
Rust
22 lines
409 B
Rust
use anyhow::Result;
|
|
use yazi_macro::act;
|
|
use yazi_parser::mgr::CloseOpt;
|
|
use yazi_shared::data::Data;
|
|
|
|
use crate::{Actor, Ctx};
|
|
|
|
pub struct Close;
|
|
|
|
impl Actor for Close {
|
|
type Options = CloseOpt;
|
|
|
|
const NAME: &str = "close";
|
|
|
|
fn act(cx: &mut Ctx, opt: Self::Options) -> Result<Data> {
|
|
if cx.tabs().len() > 1 {
|
|
act!(mgr:tab_close, cx, cx.tabs().cursor)
|
|
} else {
|
|
act!(mgr:quit, cx, opt.0)
|
|
}
|
|
}
|
|
}
|