diff --git a/Cargo.lock b/Cargo.lock index 1699cb0a..f7d2a814 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5631,6 +5631,7 @@ dependencies = [ "crossterm 0.29.0", "futures", "hashbrown 0.16.1", + "libc", "mlua", "paste", "ratatui", @@ -5639,6 +5640,7 @@ dependencies = [ "tokio-stream", "tracing", "unicode-width", + "windows-sys 0.61.2", "yazi-adapter", "yazi-codegen", "yazi-config", @@ -5949,7 +5951,6 @@ dependencies = [ "twox-hash", "unicode-width", "uzers", - "windows-sys 0.61.2", "yazi-adapter", "yazi-binding", "yazi-boot", diff --git a/yazi-actor/src/actor.rs b/yazi-actor/src/actor.rs index a09cbfd9..71e474c6 100644 --- a/yazi-actor/src/actor.rs +++ b/yazi-actor/src/actor.rs @@ -5,11 +5,11 @@ use yazi_shared::data::Data; use crate::Ctx; pub trait Actor { - type Options; + type Form; const NAME: &str; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result; + fn act(cx: &mut Ctx, form: Self::Form) -> Result; - fn hook(_cx: &Ctx, _opt: &Self::Options) -> Option { None } + fn hook(_cx: &Ctx, _form: &Self::Form) -> Option { None } } diff --git a/yazi-actor/src/app/accept_payload.rs b/yazi-actor/src/app/accept_payload.rs index 1efe777c..e9de9bed 100644 --- a/yazi-actor/src/app/accept_payload.rs +++ b/yazi-actor/src/app/accept_payload.rs @@ -13,7 +13,7 @@ use crate::{Actor, Ctx}; pub struct AcceptPayload; impl Actor for AcceptPayload { - type Options = Payload<'static>; + type Form = Payload<'static>; const NAME: &str = "accept_payload"; diff --git a/yazi-actor/src/app/bootstrap.rs b/yazi-actor/src/app/bootstrap.rs index 0fbaf3c9..312476d0 100644 --- a/yazi-actor/src/app/bootstrap.rs +++ b/yazi-actor/src/app/bootstrap.rs @@ -2,7 +2,7 @@ use anyhow::Result; use yazi_actor::Ctx; use yazi_boot::BOOT; use yazi_macro::{act, succ}; -use yazi_parser::{VoidOpt, mgr::CdSource}; +use yazi_parser::{VoidForm, mgr::CdSource}; use yazi_shared::{data::Data, strand::StrandLike, url::UrlLike}; use crate::Actor; @@ -10,11 +10,11 @@ use crate::Actor; pub struct Bootstrap; impl Actor for Bootstrap { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "bootstrap"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { cx.mgr.tabs.resize_with(BOOT.files.len(), Default::default); for (i, file) in BOOT.files.iter().enumerate().rev() { diff --git a/yazi-actor/src/app/deprecate.rs b/yazi-actor/src/app/deprecate.rs index 712863cf..afac183e 100644 --- a/yazi-actor/src/app/deprecate.rs +++ b/yazi-actor/src/app/deprecate.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::notify::{MessageLevel, MessageOpt}; use yazi_macro::act; -use yazi_parser::app::DeprecateOpt; +use yazi_parser::app::DeprecateForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Deprecate; impl Actor for Deprecate { - type Options = DeprecateOpt; + type Form = DeprecateForm; const NAME: &str = "deprecate"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(notify:push, cx, MessageOpt { title: "Deprecated API".to_owned(), content: opt.content.into_owned(), diff --git a/yazi-actor/src/app/focus.rs b/yazi-actor/src/app/focus.rs index fc5e0fa6..1d2def54 100644 --- a/yazi-actor/src/app/focus.rs +++ b/yazi-actor/src/app/focus.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_actor::Ctx; use yazi_macro::act; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::Actor; @@ -9,9 +9,9 @@ use crate::Actor; pub struct Focus; impl Actor for Focus { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "focus"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { act!(mgr:refresh, cx) } + fn act(cx: &mut Ctx, _: Self::Form) -> Result { act!(mgr:refresh, cx) } } diff --git a/yazi-actor/src/app/lua.rs b/yazi-actor/src/app/lua.rs index 553c504b..4543fcf6 100644 --- a/yazi-actor/src/app/lua.rs +++ b/yazi-actor/src/app/lua.rs @@ -2,7 +2,7 @@ use anyhow::Result; use yazi_binding::runtime_scope; use yazi_dds::Sendable; use yazi_macro::succ; -use yazi_parser::app::LuaOpt; +use yazi_parser::app::LuaForm; use yazi_plugin::LUA; use yazi_shared::data::Data; @@ -11,11 +11,11 @@ use crate::{Actor, Ctx, lives::Lives}; pub struct Lua; impl Actor for Lua { - type Options = LuaOpt; + type Form = LuaForm; const NAME: &str = "lua"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let chunk = LUA.load(&*opt.code).set_name("anonymous"); let result = Lives::scope(cx.core, || { runtime_scope!(LUA, "inline", Sendable::value_to_data(&LUA, chunk.eval()?)) diff --git a/yazi-actor/src/app/mouse.rs b/yazi-actor/src/app/mouse.rs index 4368b1dd..8f1a92ae 100644 --- a/yazi-actor/src/app/mouse.rs +++ b/yazi-actor/src/app/mouse.rs @@ -6,7 +6,7 @@ use yazi_actor::lives::Lives; use yazi_binding::runtime_scope; use yazi_config::YAZI; use yazi_macro::succ; -use yazi_parser::app::MouseOpt; +use yazi_parser::app::MouseForm; use yazi_plugin::LUA; use yazi_shared::data::Data; @@ -15,11 +15,11 @@ use crate::{Actor, Ctx}; pub struct Mouse; impl Actor for Mouse { - type Options = MouseOpt; + type Form = MouseForm; const NAME: &str = "mouse"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let event = yazi_binding::MouseEvent::from(opt.event); let Some(size) = cx.term.as_ref().and_then(|t| t.size().ok()) else { succ!() }; diff --git a/yazi-actor/src/app/plugin.rs b/yazi-actor/src/app/plugin.rs index c3437dc4..9518800d 100644 --- a/yazi-actor/src/app/plugin.rs +++ b/yazi-actor/src/app/plugin.rs @@ -11,11 +11,11 @@ use crate::{Actor, Ctx}; pub struct Plugin; impl Actor for Plugin { - type Options = PluginForm; + type Form = PluginForm; const NAME: &str = "plugin"; - fn act(cx: &mut Ctx, Self::Options { mut opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { mut opt }: Self::Form) -> Result { let mut hits = false; if let Some(chunk) = LOADER.read().get(&*opt.id) { hits = true; diff --git a/yazi-actor/src/app/plugin_do.rs b/yazi-actor/src/app/plugin_do.rs index 204d7590..b16ba31c 100644 --- a/yazi-actor/src/app/plugin_do.rs +++ b/yazi-actor/src/app/plugin_do.rs @@ -16,11 +16,11 @@ use crate::{Actor, Ctx, lives::Lives}; pub struct PluginDo; impl Actor for PluginDo { - type Options = PluginForm; + type Form = PluginForm; const NAME: &str = "plugin_do"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { let loader = LOADER.read(); let Some(chunk) = loader.get(&*opt.id) else { succ!(warn!("plugin `{}` not found", opt.id)); diff --git a/yazi-actor/src/app/quit.rs b/yazi-actor/src/app/quit.rs index db14a7ba..c00d6343 100644 --- a/yazi-actor/src/app/quit.rs +++ b/yazi-actor/src/app/quit.rs @@ -10,11 +10,11 @@ use crate::{Actor, Ctx}; pub struct Quit; impl Actor for Quit { - type Options = QuitForm; + type Form = QuitForm; const NAME: &str = "quit"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { cx.tasks.shutdown(); cx.mgr.shutdown(); diff --git a/yazi-actor/src/app/reflow.rs b/yazi-actor/src/app/reflow.rs index 6ee1c80e..df496856 100644 --- a/yazi-actor/src/app/reflow.rs +++ b/yazi-actor/src/app/reflow.rs @@ -5,7 +5,7 @@ use tracing::error; use yazi_actor::lives::Lives; use yazi_config::LAYOUT; use yazi_macro::{render, succ}; -use yazi_parser::app::ReflowOpt; +use yazi_parser::app::ReflowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -13,11 +13,11 @@ use crate::{Actor, Ctx}; pub struct Reflow; impl Actor for Reflow { - type Options = ReflowOpt; + type Form = ReflowForm; const NAME: &str = "reflow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let Some(size) = cx.term.as_ref().and_then(|t| t.size().ok()) else { succ!() }; let mut layout = LAYOUT.get(); diff --git a/yazi-actor/src/app/resize.rs b/yazi-actor/src/app/resize.rs index e9de66e6..037f62ab 100644 --- a/yazi-actor/src/app/resize.rs +++ b/yazi-actor/src/app/resize.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_actor::Ctx; use yazi_macro::act; -use yazi_parser::app::ReflowOpt; +use yazi_parser::app::ReflowForm; use yazi_shared::data::Data; use crate::Actor; @@ -9,11 +9,11 @@ use crate::Actor; pub struct Resize; impl Actor for Resize { - type Options = ReflowOpt; + type Form = ReflowForm; const NAME: &str = "resize"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(app:reflow, cx, opt)?; cx.current_mut().arrow(0); diff --git a/yazi-actor/src/app/resume.rs b/yazi-actor/src/app/resume.rs index 3a018c61..502eaaf7 100644 --- a/yazi-actor/src/app/resume.rs +++ b/yazi-actor/src/app/resume.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::app::ResumeOpt; +use yazi_parser::app::ResumeForm; use yazi_shared::data::Data; use yazi_term::Term; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Resume; impl Actor for Resume { - type Options = ResumeOpt; + type Form = ResumeForm; const NAME: &str = "resume"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { cx.active_mut().preview.reset(); *cx.term = Some(Term::start()?); diff --git a/yazi-actor/src/app/stop.rs b/yazi-actor/src/app/stop.rs index c8e3c025..69e1af0e 100644 --- a/yazi-actor/src/app/stop.rs +++ b/yazi-actor/src/app/stop.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::app::StopOpt; +use yazi_parser::app::StopForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Stop; impl Actor for Stop { - type Options = StopOpt; + type Form = StopForm; const NAME: &str = "stop"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { cx.active_mut().preview.reset_image(); // We need to destroy the `term` first before stopping the `signals` diff --git a/yazi-actor/src/app/title.rs b/yazi-actor/src/app/title.rs index c3fac5a2..6b5587b5 100644 --- a/yazi-actor/src/app/title.rs +++ b/yazi-actor/src/app/title.rs @@ -2,7 +2,7 @@ use anyhow::Result; use crossterm::{execute, terminal::SetTitle}; use yazi_actor::Ctx; use yazi_macro::succ; -use yazi_parser::{app::TitleOpt, spark::SparkKind}; +use yazi_parser::{app::TitleForm, spark::SparkKind}; use yazi_shared::{Source, data::Data}; use yazi_term::TermState; use yazi_tty::TTY; @@ -12,11 +12,11 @@ use crate::Actor; pub struct Title; impl Actor for Title { - type Options = TitleOpt; + type Form = TitleForm; const NAME: &str = "title"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let s = opt.value.unwrap_or_else(|| format!("Yazi: {}", cx.tab().name()).into()); execute!(TTY.writer(), SetTitle(&s))?; @@ -24,7 +24,7 @@ impl Actor for Title { succ!() } - fn hook(cx: &Ctx, _opt: &Self::Options) -> Option { + fn hook(cx: &Ctx, _opt: &Self::Form) -> Option { match cx.source() { Source::Ind => Some(SparkKind::IndAppTitle), _ => None, diff --git a/yazi-actor/src/app/update_progress.rs b/yazi-actor/src/app/update_progress.rs index 3d1b1741..7d4d4b05 100644 --- a/yazi-actor/src/app/update_progress.rs +++ b/yazi-actor/src/app/update_progress.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_actor::Ctx; use yazi_macro::{act, render, render_partial, succ}; -use yazi_parser::app::UpdateProgressOpt; +use yazi_parser::app::UpdateProgressForm; use yazi_shared::data::Data; use crate::Actor; @@ -9,11 +9,11 @@ use crate::Actor; pub struct UpdateProgress; impl Actor for UpdateProgress { - type Options = UpdateProgressOpt; + type Form = UpdateProgressForm; const NAME: &str = "update_progress"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { // Update the progress of all tasks. let tasks = &mut cx.tasks; let progressed = tasks.summary != opt.summary; diff --git a/yazi-actor/src/cmp/arrow.rs b/yazi-actor/src/cmp/arrow.rs index 88a868d9..5f0d4139 100644 --- a/yazi-actor/src/cmp/arrow.rs +++ b/yazi-actor/src/cmp/arrow.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use yazi_widgets::Scrollable; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Arrow; impl Actor for Arrow { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { succ!(render!(cx.cmp.scroll(opt.step))); } } diff --git a/yazi-actor/src/cmp/close.rs b/yazi-actor/src/cmp/close.rs index a762106a..633a95d6 100644 --- a/yazi-actor/src/cmp/close.rs +++ b/yazi-actor/src/cmp/close.rs @@ -2,7 +2,7 @@ use std::mem; use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::cmp::CloseOpt; +use yazi_parser::cmp::CloseForm; use yazi_shared::data::Data; use yazi_widgets::input::parser::CompleteOpt; @@ -11,11 +11,11 @@ use crate::{Actor, Ctx}; pub struct Close; impl Actor for Close { - type Options = CloseOpt; + type Form = CloseForm; const NAME: &str = "close"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let cmp = &mut cx.cmp; if let Some(item) = cmp.selected().filter(|_| opt.submit).cloned() { return act!(input:complete, cx, CompleteOpt { name: item.name, is_dir: item.is_dir, ticket: cmp.ticket }); diff --git a/yazi-actor/src/cmp/show.rs b/yazi-actor/src/cmp/show.rs index b6671e39..a29c98db 100644 --- a/yazi-actor/src/cmp/show.rs +++ b/yazi-actor/src/cmp/show.rs @@ -13,11 +13,11 @@ const LIMIT: usize = 30; pub struct Show; impl Actor for Show { - type Options = ShowForm; + type Form = ShowForm; const NAME: &str = "show"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { let cmp = &mut cx.cmp; if cmp.ticket != opt.ticket { succ!(); diff --git a/yazi-actor/src/cmp/trigger.rs b/yazi-actor/src/cmp/trigger.rs index 6d0ff3d7..5f32022d 100644 --- a/yazi-actor/src/cmp/trigger.rs +++ b/yazi-actor/src/cmp/trigger.rs @@ -4,7 +4,7 @@ use anyhow::Result; use yazi_core::cmp::{CmpItem, CmpOpt}; use yazi_fs::{path::clean_url, provider::{DirReader, FileHolder}}; use yazi_macro::{act, render, succ}; -use yazi_parser::cmp::TriggerOpt; +use yazi_parser::cmp::TriggerForm; use yazi_proxy::CmpProxy; use yazi_shared::{AnyAsciiChar, BytePredictor, data::Data, natsort, path::{AsPath, PathBufDyn, PathLike}, scheme::{SchemeCow, SchemeLike}, strand::{AsStrand, StrandLike}, url::{UrlBuf, UrlCow, UrlLike}}; use yazi_vfs::provider; @@ -14,11 +14,11 @@ use crate::{Actor, Ctx}; pub struct Trigger; impl Actor for Trigger { - type Options = TriggerOpt; + type Form = TriggerForm; const NAME: &str = "trigger"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { if opt.ticket.is_some_and(|t| t != cx.cmp.ticket) { succ!(); } else if opt.ticket.is_none() { diff --git a/yazi-actor/src/confirm/arrow.rs b/yazi-actor/src/confirm/arrow.rs index 9b0c9f6f..a892dd51 100644 --- a/yazi-actor/src/confirm/arrow.rs +++ b/yazi-actor/src/confirm/arrow.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Arrow; impl Actor for Arrow { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let confirm = &mut cx.core.confirm; let area = cx.core.mgr.area(confirm.position); diff --git a/yazi-actor/src/confirm/close.rs b/yazi-actor/src/confirm/close.rs index 315dd335..fa3001d8 100644 --- a/yazi-actor/src/confirm/close.rs +++ b/yazi-actor/src/confirm/close.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::confirm::CloseOpt; +use yazi_parser::confirm::CloseForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Close; impl Actor for Close { - type Options = CloseOpt; + type Form = CloseForm; const NAME: &str = "close"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { cx.confirm.token.complete(opt.submit); cx.confirm.visible = false; succ!(render!()); diff --git a/yazi-actor/src/confirm/show.rs b/yazi-actor/src/confirm/show.rs index d4d5be25..800d4625 100644 --- a/yazi-actor/src/confirm/show.rs +++ b/yazi-actor/src/confirm/show.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::confirm::ShowOpt; +use yazi_parser::confirm::ShowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Show; impl Actor for Show { - type Options = ShowOpt; + type Form = ShowForm; const NAME: &str = "show"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(confirm:close, cx)?; let confirm = &mut cx.confirm; diff --git a/yazi-actor/src/help/arrow.rs b/yazi-actor/src/help/arrow.rs index 495e612d..3f58c03d 100644 --- a/yazi-actor/src/help/arrow.rs +++ b/yazi-actor/src/help/arrow.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use yazi_widgets::Scrollable; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Arrow; impl Actor for Arrow { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { succ!(render!(cx.help.scroll(opt.step))); } } diff --git a/yazi-actor/src/help/escape.rs b/yazi-actor/src/help/escape.rs index d45b1802..3e26003c 100644 --- a/yazi-actor/src/help/escape.rs +++ b/yazi-actor/src/help/escape.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Escape; impl Actor for Escape { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "escape"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { if cx.help.keyword().is_none() { return act!(help:toggle, cx, cx.help.layer); } diff --git a/yazi-actor/src/help/filter.rs b/yazi-actor/src/help/filter.rs index f82c7c70..94cab689 100644 --- a/yazi-actor/src/help/filter.rs +++ b/yazi-actor/src/help/filter.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Filter; impl Actor for Filter { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "filter"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let help = &mut cx.help; help.in_filter = Some(Default::default()); diff --git a/yazi-actor/src/help/toggle.rs b/yazi-actor/src/help/toggle.rs index 37074dec..c3abf422 100644 --- a/yazi-actor/src/help/toggle.rs +++ b/yazi-actor/src/help/toggle.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::help::ToggleOpt; +use yazi_parser::help::ToggleForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Toggle; impl Actor for Toggle { - type Options = ToggleOpt; + type Form = ToggleForm; const NAME: &str = "toggle"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let help = &mut cx.help; help.visible = !help.visible; diff --git a/yazi-actor/src/input/close.rs b/yazi-actor/src/input/close.rs index 5532109d..5077cfc2 100644 --- a/yazi-actor/src/input/close.rs +++ b/yazi-actor/src/input/close.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::input::CloseOpt; +use yazi_parser::input::CloseForm; use yazi_shared::data::Data; use yazi_widgets::input::InputEvent; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Close; impl Actor for Close { - type Options = CloseOpt; + type Form = CloseForm; const NAME: &str = "close"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let input = &mut cx.input; input.visible = false; input.ticket.next(); diff --git a/yazi-actor/src/input/complete.rs b/yazi-actor/src/input/complete.rs index c0120e9b..faa9e341 100644 --- a/yazi-actor/src/input/complete.rs +++ b/yazi-actor/src/input/complete.rs @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Complete; impl Actor for Complete { - type Options = CompleteOpt; + type Form = CompleteOpt; const NAME: &str = "complete"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let input = &mut cx.input; if !input.visible || input.ticket.current() != opt.ticket { succ!(); diff --git a/yazi-actor/src/input/escape.rs b/yazi-actor/src/input/escape.rs index 0bde71e9..495e0528 100644 --- a/yazi-actor/src/input/escape.rs +++ b/yazi-actor/src/input/escape.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use yazi_widgets::input::InputOp; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Escape; impl Actor for Escape { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "escape"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { use yazi_widgets::input::InputMode as M; let input = &mut cx.input; diff --git a/yazi-actor/src/input/show.rs b/yazi-actor/src/input/show.rs index cab85543..beec471e 100644 --- a/yazi-actor/src/input/show.rs +++ b/yazi-actor/src/input/show.rs @@ -10,11 +10,11 @@ use crate::{Actor, Ctx}; pub struct Show; impl Actor for Show { - type Options = InputOpt; + type Form = InputOpt; const NAME: &str = "show"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(input:close, cx)?; let input = &mut cx.input; diff --git a/yazi-actor/src/mgr/arrow.rs b/yazi-actor/src/mgr/arrow.rs index b6c60b9f..be7ba2c7 100644 --- a/yazi-actor/src/mgr/arrow.rs +++ b/yazi-actor/src/mgr/arrow.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Arrow; impl Actor for Arrow { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tab = cx.tab_mut(); if !tab.current.arrow(opt.step) { succ!(); diff --git a/yazi-actor/src/mgr/back.rs b/yazi-actor/src/mgr/back.rs index b8ba672d..1f604819 100644 --- a/yazi-actor/src/mgr/back.rs +++ b/yazi-actor/src/mgr/back.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, succ}; -use yazi_parser::{VoidOpt, mgr::CdSource}; +use yazi_parser::{VoidForm, mgr::CdSource}; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Back; impl Actor for Back { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "back"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { if let Some(u) = cx.tab_mut().backstack.shift_backward().cloned() { act!(mgr:cd, cx, (u, CdSource::Back))?; } diff --git a/yazi-actor/src/mgr/bulk_exit.rs b/yazi-actor/src/mgr/bulk_exit.rs index 05271e2a..84dc5dc6 100644 --- a/yazi-actor/src/mgr/bulk_exit.rs +++ b/yazi-actor/src/mgr/bulk_exit.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::mgr::BulkExitOpt; +use yazi_parser::mgr::BulkExitForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct BulkExit; impl Actor for BulkExit { - type Options = BulkExitOpt; + type Form = BulkExitForm; const NAME: &str = "bulk_exit"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { cx.mgr.batcher.decide(opt.target, opt.accept); succ!(); } diff --git a/yazi-actor/src/mgr/bulk_rename.rs b/yazi-actor/src/mgr/bulk_rename.rs index fa7b6977..7443980d 100644 --- a/yazi-actor/src/mgr/bulk_rename.rs +++ b/yazi-actor/src/mgr/bulk_rename.rs @@ -10,7 +10,7 @@ use yazi_config::{YAZI, opener::OpenerRule}; use yazi_dds::Pubsub; use yazi_fs::{File, FilesOp, Splatter, max_common_root, path::skip_url, provider::{FileBuilder, Provider, local::{Gate, Local}}}; use yazi_macro::{err, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_proxy::TasksProxy; use yazi_scheduler::{AppProxy, NotifyProxy}; use yazi_shared::{data::Data, path::PathDyn, strand::{AsStrand, AsStrandJoin, Strand, StrandBuf, StrandLike}, terminal_clear, url::{AsUrl, UrlBuf, UrlCow, UrlLike}}; @@ -24,11 +24,11 @@ use crate::{Actor, Ctx}; pub struct BulkRename; impl Actor for BulkRename { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "bulk_rename"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let Some(opener) = Self::opener() else { succ!(NotifyProxy::push_warn("Bulk rename", "No text opener found")); }; diff --git a/yazi-actor/src/mgr/cd.rs b/yazi-actor/src/mgr/cd.rs index 28341406..41e82528 100644 --- a/yazi-actor/src/mgr/cd.rs +++ b/yazi-actor/src/mgr/cd.rs @@ -7,7 +7,7 @@ use yazi_config::popup::InputCfg; use yazi_dds::Pubsub; use yazi_fs::{File, FilesOp, path::{clean_url, expand_url}}; use yazi_macro::{act, err, render, succ}; -use yazi_parser::mgr::CdOpt; +use yazi_parser::mgr::CdForm; use yazi_proxy::{CmpProxy, InputProxy, MgrProxy}; use yazi_shared::{Debounce, data::Data, url::{AsUrl, UrlBuf, UrlLike}}; use yazi_vfs::{VfsFile, provider}; @@ -18,11 +18,11 @@ use crate::{Actor, Ctx}; pub struct Cd; impl Actor for Cd { - type Options = CdOpt; + type Form = CdForm; const NAME: &str = "cd"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(mgr:escape_visual, cx)?; if opt.interactive { return Self::cd_interactive(cx); diff --git a/yazi-actor/src/mgr/close.rs b/yazi-actor/src/mgr/close.rs index debe3aa7..44cbc490 100644 --- a/yazi-actor/src/mgr/close.rs +++ b/yazi-actor/src/mgr/close.rs @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Close; impl Actor for Close { - type Options = CloseForm; + type Form = CloseForm; const NAME: &str = "close"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { if cx.tabs().len() > 1 { act!(mgr:tab_close, cx, cx.tabs().cursor) } else { diff --git a/yazi-actor/src/mgr/copy.rs b/yazi-actor/src/mgr/copy.rs index 0ccf4ff9..8d3527f4 100644 --- a/yazi-actor/src/mgr/copy.rs +++ b/yazi-actor/src/mgr/copy.rs @@ -1,6 +1,6 @@ use anyhow::{Result, bail}; use yazi_macro::{act, succ}; -use yazi_parser::mgr::CopyOpt; +use yazi_parser::mgr::CopyForm; use yazi_shared::{data::Data, strand::ToStrand, url::UrlLike}; use yazi_widgets::CLIPBOARD; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Copy; impl Actor for Copy { - type Options = CopyOpt; + type Form = CopyForm; const NAME: &str = "copy"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(mgr:escape_visual, cx)?; let mut s = Vec::::new(); diff --git a/yazi-actor/src/mgr/create.rs b/yazi-actor/src/mgr/create.rs index 5a2b44e1..58654c5e 100644 --- a/yazi-actor/src/mgr/create.rs +++ b/yazi-actor/src/mgr/create.rs @@ -2,7 +2,7 @@ use anyhow::{Result, bail}; use yazi_config::popup::{ConfirmCfg, InputCfg}; use yazi_fs::{File, FilesOp}; use yazi_macro::{ok_or_not_found, succ}; -use yazi_parser::mgr::CreateOpt; +use yazi_parser::mgr::CreateForm; use yazi_proxy::{ConfirmProxy, InputProxy, MgrProxy}; use yazi_shared::{data::Data, url::{UrlBuf, UrlLike}}; use yazi_vfs::{VfsFile, maybe_exists, provider}; @@ -14,11 +14,11 @@ use crate::{Actor, Ctx}; pub struct Create; impl Actor for Create { - type Options = CreateOpt; + type Form = CreateForm; const NAME: &str = "create"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let cwd = cx.cwd().to_owned(); let mut input = InputProxy::show(InputCfg::create(opt.dir)); diff --git a/yazi-actor/src/mgr/displace.rs b/yazi-actor/src/mgr/displace.rs index 82118dae..c6339beb 100644 --- a/yazi-actor/src/mgr/displace.rs +++ b/yazi-actor/src/mgr/displace.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::mgr::DisplaceOpt; use yazi_macro::succ; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_proxy::MgrProxy; use yazi_shared::{data::Data, url::UrlLike}; use yazi_vfs::provider; @@ -11,11 +11,11 @@ use crate::{Actor, Ctx}; pub struct Displace; impl Actor for Displace { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "displace"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { if cx.cwd().is_absolute() { succ!(); } diff --git a/yazi-actor/src/mgr/displace_do.rs b/yazi-actor/src/mgr/displace_do.rs index 2e488ad2..172629f7 100644 --- a/yazi-actor/src/mgr/displace_do.rs +++ b/yazi-actor/src/mgr/displace_do.rs @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct DisplaceDo; impl Actor for DisplaceDo { - type Options = DisplaceDoForm; + type Form = DisplaceDoForm; const NAME: &str = "displace_do"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { if cx.cwd() != opt.from { succ!() } diff --git a/yazi-actor/src/mgr/download.rs b/yazi-actor/src/mgr/download.rs index 47b62433..c583f612 100644 --- a/yazi-actor/src/mgr/download.rs +++ b/yazi-actor/src/mgr/download.rs @@ -6,7 +6,7 @@ use hashbrown::HashSet; use yazi_core::mgr::OpenOpt; use yazi_fs::{File, FsScheme, provider::{Provider, local::Local}}; use yazi_macro::succ; -use yazi_parser::mgr::DownloadOpt; +use yazi_parser::mgr::DownloadForm; use yazi_proxy::MgrProxy; use yazi_shared::{data::Data, url::{UrlCow, UrlLike}}; use yazi_vfs::VfsFile; @@ -16,11 +16,11 @@ use crate::{Actor, Ctx}; pub struct Download; impl Actor for Download { - type Options = DownloadOpt; + type Form = DownloadForm; const NAME: &str = "download"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let cwd = cx.cwd().clone(); let scheduler = cx.tasks.scheduler.clone(); diff --git a/yazi-actor/src/mgr/enter.rs b/yazi-actor/src/mgr/enter.rs index abae6034..54c9aead 100644 --- a/yazi-actor/src/mgr/enter.rs +++ b/yazi-actor/src/mgr/enter.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, succ}; -use yazi_parser::{VoidOpt, mgr::CdSource}; +use yazi_parser::{VoidForm, mgr::CdSource}; use yazi_shared::{data::Data, url::UrlLike}; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Enter; impl Actor for Enter { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "enter"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let Some(h) = cx.hovered().filter(|h| h.is_dir()) else { succ!() }; let url = if h.url.is_search() { h.url.to_regular()? } else { h.url.clone() }; diff --git a/yazi-actor/src/mgr/escape.rs b/yazi-actor/src/mgr/escape.rs index fae730a3..ea0ab495 100644 --- a/yazi-actor/src/mgr/escape.rs +++ b/yazi-actor/src/mgr/escape.rs @@ -1,6 +1,6 @@ use anyhow::{Result, bail}; use yazi_macro::{act, render, render_and, succ}; -use yazi_parser::{VoidOpt, mgr::EscapeOpt}; +use yazi_parser::{VoidForm, mgr::EscapeForm}; use yazi_scheduler::NotifyProxy; use yazi_shared::{data::Data, url::UrlLike}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Escape; impl Actor for Escape { - type Options = EscapeOpt; + type Form = EscapeForm; const NAME: &str = "escape"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { if opt.is_empty() { _ = act!(mgr:escape_find, cx)? != false || act!(mgr:escape_visual, cx)? != false @@ -23,19 +23,19 @@ impl Actor for Escape { succ!(); } - if opt.contains(EscapeOpt::FIND) { + if opt.contains(EscapeForm::FIND) { act!(mgr:escape_find, cx)?; } - if opt.contains(EscapeOpt::VISUAL) { + if opt.contains(EscapeForm::VISUAL) { act!(mgr:escape_visual, cx)?; } - if opt.contains(EscapeOpt::FILTER) { + if opt.contains(EscapeForm::FILTER) { act!(mgr:escape_filter, cx)?; } - if opt.contains(EscapeOpt::SELECT) { + if opt.contains(EscapeForm::SELECT) { act!(mgr:escape_select, cx)?; } - if opt.contains(EscapeOpt::SEARCH) { + if opt.contains(EscapeForm::SEARCH) { act!(mgr:escape_search, cx)?; } succ!(); @@ -46,11 +46,11 @@ impl Actor for Escape { pub struct EscapeFind; impl Actor for EscapeFind { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "escape_find"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { succ!(render_and!(cx.tab_mut().finder.take().is_some())) } } @@ -59,11 +59,11 @@ impl Actor for EscapeFind { pub struct EscapeVisual; impl Actor for EscapeVisual { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "escape_visual"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let tab = cx.tab_mut(); let select = tab.mode.is_select(); @@ -91,11 +91,11 @@ impl Actor for EscapeVisual { pub struct EscapeFilter; impl Actor for EscapeFilter { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "escape_filter"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { if cx.current_mut().files.filter().is_none() { succ!(false); } @@ -110,11 +110,11 @@ impl Actor for EscapeFilter { pub struct EscapeSelect; impl Actor for EscapeSelect { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "escape_select"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let tab = cx.tab_mut(); if tab.selected.is_empty() { succ!(false); @@ -134,11 +134,11 @@ impl Actor for EscapeSelect { pub struct EscapeSearch; impl Actor for EscapeSearch { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "escape_search"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let b = cx.cwd().is_search(); act!(mgr:search_stop, cx)?; succ!(render_and!(b)); diff --git a/yazi-actor/src/mgr/filter.rs b/yazi-actor/src/mgr/filter.rs index 7c590819..a0c52696 100644 --- a/yazi-actor/src/mgr/filter.rs +++ b/yazi-actor/src/mgr/filter.rs @@ -16,11 +16,11 @@ use crate::{Actor, Ctx}; pub struct Filter; impl Actor for Filter { - type Options = FilterForm; + type Form = FilterForm; const NAME: &str = "filter"; - fn act(_: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(_: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { let input = InputProxy::show(InputCfg::filter()); tokio::spawn(async move { diff --git a/yazi-actor/src/mgr/filter_do.rs b/yazi-actor/src/mgr/filter_do.rs index d0e97db5..b1758234 100644 --- a/yazi-actor/src/mgr/filter_do.rs +++ b/yazi-actor/src/mgr/filter_do.rs @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct FilterDo; impl Actor for FilterDo { - type Options = FilterForm; + type Form = FilterForm; const NAME: &str = "filter_do"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { let filter = if opt.query.is_empty() { None } else { Some(Filter::new(&opt.query, opt.case)?) }; let hovered = cx.hovered().map(|f| f.urn().into()); diff --git a/yazi-actor/src/mgr/find.rs b/yazi-actor/src/mgr/find.rs index 0f555160..efb567c2 100644 --- a/yazi-actor/src/mgr/find.rs +++ b/yazi-actor/src/mgr/find.rs @@ -6,7 +6,7 @@ use tokio_stream::{StreamExt, wrappers::UnboundedReceiverStream}; use yazi_config::popup::InputCfg; use yazi_core::mgr::FindDoOpt; use yazi_macro::succ; -use yazi_parser::mgr::FindOpt; +use yazi_parser::mgr::FindForm; use yazi_proxy::{InputProxy, MgrProxy}; use yazi_shared::{Debounce, data::Data}; use yazi_widgets::input::InputEvent; @@ -16,11 +16,11 @@ use crate::{Actor, Ctx}; pub struct Find; impl Actor for Find { - type Options = FindOpt; + type Form = FindForm; const NAME: &str = "find"; - fn act(_: &mut Ctx, opt: Self::Options) -> Result { + fn act(_: &mut Ctx, opt: Self::Form) -> Result { let input = InputProxy::show(InputCfg::find(opt.prev)); tokio::spawn(async move { diff --git a/yazi-actor/src/mgr/find_arrow.rs b/yazi-actor/src/mgr/find_arrow.rs index 7ef3067a..13826762 100644 --- a/yazi-actor/src/mgr/find_arrow.rs +++ b/yazi-actor/src/mgr/find_arrow.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::FindArrowOpt; +use yazi_parser::mgr::FindArrowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct FindArrow; impl Actor for FindArrow { - type Options = FindArrowOpt; + type Form = FindArrowForm; const NAME: &str = "find_arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tab = cx.tab_mut(); let Some(finder) = &mut tab.finder else { succ!() }; diff --git a/yazi-actor/src/mgr/find_do.rs b/yazi-actor/src/mgr/find_do.rs index 5e4053c2..abc2cf1e 100644 --- a/yazi-actor/src/mgr/find_do.rs +++ b/yazi-actor/src/mgr/find_do.rs @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct FindDo; impl Actor for FindDo { - type Options = FindDoForm; + type Form = FindDoForm; const NAME: &str = "find_do"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { if opt.query.is_empty() { return act!(mgr:escape_find, cx); } diff --git a/yazi-actor/src/mgr/follow.rs b/yazi-actor/src/mgr/follow.rs index b0a699dc..b713524b 100644 --- a/yazi-actor/src/mgr/follow.rs +++ b/yazi-actor/src/mgr/follow.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_fs::path::clean_url; use yazi_macro::{act, succ}; -use yazi_parser::{VoidOpt, mgr::CdSource}; +use yazi_parser::{VoidForm, mgr::CdSource}; use yazi_shared::{data::Data, url::UrlLike}; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Follow; impl Actor for Follow { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "follow"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let Some(file) = cx.hovered() else { succ!() }; let Some(link_to) = &file.link_to else { succ!() }; let Some(parent) = file.url.parent() else { succ!() }; diff --git a/yazi-actor/src/mgr/forward.rs b/yazi-actor/src/mgr/forward.rs index b0a10732..e226f7a7 100644 --- a/yazi-actor/src/mgr/forward.rs +++ b/yazi-actor/src/mgr/forward.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, succ}; -use yazi_parser::{VoidOpt, mgr::CdSource}; +use yazi_parser::{VoidForm, mgr::CdSource}; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Forward; impl Actor for Forward { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "forward"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { if let Some(u) = cx.tab_mut().backstack.shift_forward().cloned() { act!(mgr:cd, cx, (u, CdSource::Forward))?; } diff --git a/yazi-actor/src/mgr/hardlink.rs b/yazi-actor/src/mgr/hardlink.rs index 59006581..48008c8b 100644 --- a/yazi-actor/src/mgr/hardlink.rs +++ b/yazi-actor/src/mgr/hardlink.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::mgr::HardlinkOpt; +use yazi_parser::mgr::HardlinkForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Hardlink; impl Actor for Hardlink { - type Options = HardlinkOpt; + type Form = HardlinkForm; const NAME: &str = "hardlink"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let mgr = &mut cx.core.mgr; let tab = &mgr.tabs[cx.tab]; diff --git a/yazi-actor/src/mgr/hidden.rs b/yazi-actor/src/mgr/hidden.rs index fc202a26..5ed09ab9 100644 --- a/yazi-actor/src/mgr/hidden.rs +++ b/yazi-actor/src/mgr/hidden.rs @@ -2,7 +2,7 @@ use anyhow::Result; use yazi_core::tab::Folder; use yazi_fs::FolderStage; use yazi_macro::{act, render, render_and, succ}; -use yazi_parser::{mgr::HiddenOpt, spark::SparkKind}; +use yazi_parser::{mgr::HiddenForm, spark::SparkKind}; use yazi_shared::{Source, data::Data}; use crate::{Actor, Ctx}; @@ -10,11 +10,11 @@ use crate::{Actor, Ctx}; pub struct Hidden; impl Actor for Hidden { - type Options = HiddenOpt; + type Form = HiddenForm; const NAME: &str = "hidden"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let state = opt.state.bool(cx.tab().pref.show_hidden); cx.tab_mut().pref.show_hidden = state; @@ -51,7 +51,7 @@ impl Actor for Hidden { succ!() } - fn hook(cx: &Ctx, _: &Self::Options) -> Option { + fn hook(cx: &Ctx, _: &Self::Form) -> Option { match cx.source() { Source::Ind => Some(SparkKind::IndHidden), Source::Key => Some(SparkKind::KeyHidden), diff --git a/yazi-actor/src/mgr/hover.rs b/yazi-actor/src/mgr/hover.rs index 579d4003..add8ce89 100644 --- a/yazi-actor/src/mgr/hover.rs +++ b/yazi-actor/src/mgr/hover.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_dds::Pubsub; use yazi_macro::{err, render, succ, tab}; -use yazi_parser::mgr::HoverOpt; +use yazi_parser::mgr::HoverForm; use yazi_shared::{data::Data, url::UrlLike}; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Hover; impl Actor for Hover { - type Options = HoverOpt; + type Form = HoverForm; const NAME: &str = "hover"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tab = tab!(cx); // Parent should always track CWD diff --git a/yazi-actor/src/mgr/leave.rs b/yazi-actor/src/mgr/leave.rs index c83d2f23..a3b9b7b8 100644 --- a/yazi-actor/src/mgr/leave.rs +++ b/yazi-actor/src/mgr/leave.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, succ}; -use yazi_parser::{VoidOpt, mgr::CdSource}; +use yazi_parser::{VoidForm, mgr::CdSource}; use yazi_shared::{data::Data, url::UrlLike}; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Leave; impl Actor for Leave { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "leave"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let url = cx .hovered() .and_then(|h| h.url.parent()) diff --git a/yazi-actor/src/mgr/linemode.rs b/yazi-actor/src/mgr/linemode.rs index 3cd6dc91..0bbf7222 100644 --- a/yazi-actor/src/mgr/linemode.rs +++ b/yazi-actor/src/mgr/linemode.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::mgr::LinemodeOpt; +use yazi_parser::mgr::LinemodeForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Linemode; impl Actor for Linemode { - type Options = LinemodeOpt; + type Form = LinemodeForm; const NAME: &str = "linemode"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tab = cx.tab_mut(); if opt.new != tab.pref.linemode { diff --git a/yazi-actor/src/mgr/link.rs b/yazi-actor/src/mgr/link.rs index 868489a7..1e304cf3 100644 --- a/yazi-actor/src/mgr/link.rs +++ b/yazi-actor/src/mgr/link.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::mgr::LinkOpt; +use yazi_parser::mgr::LinkForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Link; impl Actor for Link { - type Options = LinkOpt; + type Form = LinkForm; const NAME: &str = "link"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let mgr = &mut cx.core.mgr; let tab = &mgr.tabs[cx.tab]; diff --git a/yazi-actor/src/mgr/open.rs b/yazi-actor/src/mgr/open.rs index 0ccb6d16..d49bf177 100644 --- a/yazi-actor/src/mgr/open.rs +++ b/yazi-actor/src/mgr/open.rs @@ -13,11 +13,11 @@ use crate::{Actor, Ctx, mgr::Quit}; pub struct Open; impl Actor for Open { - type Options = OpenForm; + type Form = OpenForm; const NAME: &str = "open"; - fn act(cx: &mut Ctx, Self::Options { mut opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { mut opt }: Self::Form) -> Result { if !opt.interactive && ARGS.chooser_file.is_some() { succ!(if !opt.targets.is_empty() { Quit::with_selected(opt.targets) diff --git a/yazi-actor/src/mgr/open_do.rs b/yazi-actor/src/mgr/open_do.rs index 84fba983..95d59e00 100644 --- a/yazi-actor/src/mgr/open_do.rs +++ b/yazi-actor/src/mgr/open_do.rs @@ -12,11 +12,11 @@ use crate::{Actor, Ctx}; pub struct OpenDo; impl Actor for OpenDo { - type Options = OpenDoForm; + type Form = OpenDoForm; const NAME: &str = "open_do"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { let targets: Vec<_> = opt .targets .into_iter() diff --git a/yazi-actor/src/mgr/paste.rs b/yazi-actor/src/mgr/paste.rs index a5f86496..92d4d7ea 100644 --- a/yazi-actor/src/mgr/paste.rs +++ b/yazi-actor/src/mgr/paste.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, succ}; -use yazi_parser::mgr::PasteOpt; +use yazi_parser::mgr::PasteForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Paste; impl Actor for Paste { - type Options = PasteOpt; + type Form = PasteForm; const NAME: &str = "paste"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let mgr = &mut cx.core.mgr; let tab = &mgr.tabs[cx.tab]; diff --git a/yazi-actor/src/mgr/peek.rs b/yazi-actor/src/mgr/peek.rs index aa16fe95..bbcfa6bc 100644 --- a/yazi-actor/src/mgr/peek.rs +++ b/yazi-actor/src/mgr/peek.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::mgr::PeekOpt; +use yazi_parser::mgr::PeekForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Peek; impl Actor for Peek { - type Options = PeekOpt; + type Form = PeekForm; const NAME: &str = "peek"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let Some(hovered) = cx.hovered().cloned() else { succ!(cx.tab_mut().preview.reset()); }; diff --git a/yazi-actor/src/mgr/quit.rs b/yazi-actor/src/mgr/quit.rs index 25932cd4..43f8dcd2 100644 --- a/yazi-actor/src/mgr/quit.rs +++ b/yazi-actor/src/mgr/quit.rs @@ -14,11 +14,11 @@ use crate::{Actor, Ctx}; pub struct Quit; impl Actor for Quit { - type Options = QuitForm; + type Form = QuitForm; const NAME: &str = "quit"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { let ongoing = cx.tasks.scheduler.ongoing.clone(); let (left, left_names) = { let ongoing = ongoing.lock(); @@ -58,7 +58,7 @@ impl Actor for Quit { succ!(); } - fn hook(cx: &Ctx, _opt: &Self::Options) -> Option { + fn hook(cx: &Ctx, _opt: &Self::Form) -> Option { Some(SparkKind::KeyQuit).filter(|_| cx.source().is_key()) } } diff --git a/yazi-actor/src/mgr/refresh.rs b/yazi-actor/src/mgr/refresh.rs index 6c3e3017..00b05022 100644 --- a/yazi-actor/src/mgr/refresh.rs +++ b/yazi-actor/src/mgr/refresh.rs @@ -2,7 +2,7 @@ use anyhow::Result; use yazi_core::tab::Folder; use yazi_fs::{CWD, Files, FilesOp, cha::Cha}; use yazi_macro::{act, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::{data::Data, url::{UrlBuf, UrlLike}}; use yazi_vfs::{VfsFiles, VfsFilesOp}; use yazi_watcher::MgrProxy; @@ -12,11 +12,11 @@ use crate::{Actor, Ctx}; pub struct Refresh; impl Actor for Refresh { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "refresh"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { CWD.set(cx.cwd(), Self::cwd_changed); if let Some(p) = cx.parent() { diff --git a/yazi-actor/src/mgr/remove.rs b/yazi-actor/src/mgr/remove.rs index e2bdd265..b62f7dbd 100644 --- a/yazi-actor/src/mgr/remove.rs +++ b/yazi-actor/src/mgr/remove.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_config::popup::ConfirmCfg; use yazi_macro::{act, succ}; -use yazi_parser::mgr::RemoveOpt; +use yazi_parser::mgr::RemoveForm; use yazi_proxy::{ConfirmProxy, MgrProxy}; use yazi_shared::data::Data; @@ -10,11 +10,11 @@ use crate::{Actor, Ctx}; pub struct Remove; impl Actor for Remove { - type Options = RemoveOpt; + type Form = RemoveForm; const NAME: &str = "remove"; - fn act(cx: &mut Ctx, mut opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, mut opt: Self::Form) -> Result { act!(mgr:escape_visual, cx)?; opt.targets = if opt.hovered { @@ -48,11 +48,11 @@ impl Actor for Remove { pub struct RemoveDo; impl Actor for RemoveDo { - type Options = RemoveOpt; + type Form = RemoveForm; const NAME: &str = "remove_do"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let mgr = &mut cx.mgr; mgr.tabs.iter_mut().for_each(|t| { diff --git a/yazi-actor/src/mgr/rename.rs b/yazi-actor/src/mgr/rename.rs index b809102d..a91e5552 100644 --- a/yazi-actor/src/mgr/rename.rs +++ b/yazi-actor/src/mgr/rename.rs @@ -3,7 +3,7 @@ use yazi_config::popup::{ConfirmCfg, InputCfg}; use yazi_dds::Pubsub; use yazi_fs::{File, FilesOp}; use yazi_macro::{act, err, ok_or_not_found, succ}; -use yazi_parser::mgr::RenameOpt; +use yazi_parser::mgr::RenameForm; use yazi_proxy::{ConfirmProxy, InputProxy, MgrProxy}; use yazi_shared::{Id, data::Data, url::{UrlBuf, UrlLike}}; use yazi_vfs::{VfsFile, maybe_exists, provider}; @@ -15,11 +15,11 @@ use crate::{Actor, Ctx}; pub struct Rename; impl Actor for Rename { - type Options = RenameOpt; + type Form = RenameForm; const NAME: &str = "rename"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(mgr:escape_visual, cx)?; if !opt.hovered && !cx.tab().selected.is_empty() { diff --git a/yazi-actor/src/mgr/reveal.rs b/yazi-actor/src/mgr/reveal.rs index 7da8ea1b..35a3bf4f 100644 --- a/yazi-actor/src/mgr/reveal.rs +++ b/yazi-actor/src/mgr/reveal.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_fs::{File, FilesOp}; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::RevealOpt; +use yazi_parser::mgr::RevealForm; use yazi_shared::{data::Data, url::UrlLike}; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Reveal; impl Actor for Reveal { - type Options = RevealOpt; + type Form = RevealForm; const NAME: &str = "reveal"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let Some((parent, child)) = opt.target.pair() else { succ!() }; // Cd to the parent directory diff --git a/yazi-actor/src/mgr/search.rs b/yazi-actor/src/mgr/search.rs index e9d87e46..2dae9fcb 100644 --- a/yazi-actor/src/mgr/search.rs +++ b/yazi-actor/src/mgr/search.rs @@ -7,7 +7,7 @@ use yazi_config::popup::InputCfg; use yazi_core::mgr::SearchVia; use yazi_fs::{FilesOp, cha::Cha}; use yazi_macro::{act, succ}; -use yazi_parser::{VoidOpt, mgr::{CdSource, SearchForm}}; +use yazi_parser::{VoidForm, mgr::{CdSource, SearchForm}}; use yazi_plugin::external; use yazi_proxy::{InputProxy, MgrProxy}; use yazi_scheduler::NotifyProxy; @@ -19,11 +19,11 @@ use crate::{Actor, Ctx}; pub struct Search; impl Actor for Search { - type Options = SearchForm; + type Form = SearchForm; const NAME: &str = "search"; - fn act(cx: &mut Ctx, Self::Options { mut opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { mut opt }: Self::Form) -> Result { if let Some(handle) = cx.tab_mut().search.take() { handle.abort(); } @@ -45,11 +45,11 @@ impl Actor for Search { pub struct SearchDo; impl Actor for SearchDo { - type Options = SearchForm; + type Form = SearchForm; const NAME: &str = "search_do"; - fn act(cx: &mut Ctx, Self::Options { opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt }: Self::Form) -> Result { let tab = cx.tab_mut(); if let Some(handle) = tab.search.take() { handle.abort(); @@ -103,11 +103,11 @@ impl Actor for SearchDo { pub struct SearchStop; impl Actor for SearchStop { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "search_stop"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let tab = cx.tab_mut(); if let Some(handle) = tab.search.take() { handle.abort(); diff --git a/yazi-actor/src/mgr/seek.rs b/yazi-actor/src/mgr/seek.rs index 2822e89c..f5cddbf1 100644 --- a/yazi-actor/src/mgr/seek.rs +++ b/yazi-actor/src/mgr/seek.rs @@ -2,7 +2,7 @@ use anyhow::Result; use mlua::ObjectLike; use yazi_config::YAZI; use yazi_macro::{act, succ}; -use yazi_parser::mgr::SeekOpt; +use yazi_parser::mgr::SeekForm; use yazi_runner::{plugin::PluginOpt, previewer::SeekJob}; use yazi_shared::data::Data; @@ -11,11 +11,11 @@ use crate::{Actor, Ctx}; pub struct Seek; impl Actor for Seek { - type Options = SeekOpt; + type Form = SeekForm; const NAME: &str = "seek"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let Some(hovered) = cx.hovered() else { succ!(cx.tab_mut().preview.reset()); }; diff --git a/yazi-actor/src/mgr/shell.rs b/yazi-actor/src/mgr/shell.rs index dae4205c..30900820 100644 --- a/yazi-actor/src/mgr/shell.rs +++ b/yazi-actor/src/mgr/shell.rs @@ -3,7 +3,7 @@ use std::borrow::Cow; use anyhow::Result; use yazi_config::popup::InputCfg; use yazi_macro::{act, succ}; -use yazi_parser::mgr::ShellOpt; +use yazi_parser::mgr::ShellForm; use yazi_proxy::{InputProxy, TasksProxy}; use yazi_scheduler::process::ProcessOpt; use yazi_shared::data::Data; @@ -14,11 +14,11 @@ use crate::{Actor, Ctx}; pub struct Shell; impl Actor for Shell { - type Options = ShellOpt; + type Form = ShellForm; const NAME: &str = "shell"; - fn act(cx: &mut Ctx, mut opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, mut opt: Self::Form) -> Result { act!(mgr:escape_visual, cx)?; let cwd = opt.cwd.take().unwrap_or(cx.cwd().into()).into_owned(); diff --git a/yazi-actor/src/mgr/sort.rs b/yazi-actor/src/mgr/sort.rs index f5da8a14..d4e28374 100644 --- a/yazi-actor/src/mgr/sort.rs +++ b/yazi-actor/src/mgr/sort.rs @@ -2,7 +2,7 @@ use anyhow::Result; use yazi_core::tab::Folder; use yazi_fs::{FilesSorter, FolderStage}; use yazi_macro::{act, render, render_and, succ}; -use yazi_parser::{mgr::SortOpt, spark::SparkKind}; +use yazi_parser::{mgr::SortForm, spark::SparkKind}; use yazi_shared::{Source, data::Data}; use crate::{Actor, Ctx}; @@ -10,11 +10,11 @@ use crate::{Actor, Ctx}; pub struct Sort; impl Actor for Sort { - type Options = SortOpt; + type Form = SortForm; const NAME: &str = "sort"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let pref = &mut cx.tab_mut().pref; pref.sort_by = opt.by.unwrap_or(pref.sort_by); pref.sort_reverse = opt.reverse.unwrap_or(pref.sort_reverse); @@ -58,7 +58,7 @@ impl Actor for Sort { succ!(); } - fn hook(cx: &Ctx, _: &Self::Options) -> Option { + fn hook(cx: &Ctx, _: &Self::Form) -> Option { match cx.source() { Source::Ind => Some(SparkKind::IndSort), Source::Key => Some(SparkKind::KeySort), diff --git a/yazi-actor/src/mgr/spot.rs b/yazi-actor/src/mgr/spot.rs index dc35f2dd..61271f46 100644 --- a/yazi-actor/src/mgr/spot.rs +++ b/yazi-actor/src/mgr/spot.rs @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Spot; impl Actor for Spot { - type Options = SpotOpt; + type Form = SpotOpt; const NAME: &str = "spot"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(mgr:escape_visual, cx)?; let Some(hovered) = cx.hovered().cloned() else { succ!() }; diff --git a/yazi-actor/src/mgr/stash.rs b/yazi-actor/src/mgr/stash.rs index f149809f..3de22742 100644 --- a/yazi-actor/src/mgr/stash.rs +++ b/yazi-actor/src/mgr/stash.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::{mgr::StashOpt, spark::SparkKind}; +use yazi_parser::{mgr::StashForm, spark::SparkKind}; use yazi_shared::{Source, data::Data, url::{AsUrl, UrlLike}}; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Stash; impl Actor for Stash { - type Options = StashOpt; + type Form = StashForm; const NAME: &str = "stash"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { if opt.target.is_absolute() && opt.target.is_internal() { cx.tab_mut().backstack.push(opt.target.as_url()); } @@ -20,7 +20,7 @@ impl Actor for Stash { succ!() } - fn hook(cx: &Ctx, _opt: &Self::Options) -> Option { + fn hook(cx: &Ctx, _opt: &Self::Form) -> Option { match cx.source() { Source::Ind => Some(SparkKind::IndStash), Source::Relay => Some(SparkKind::RelayStash), diff --git a/yazi-actor/src/mgr/suspend.rs b/yazi-actor/src/mgr/suspend.rs index b34eac63..6db3263b 100644 --- a/yazi-actor/src/mgr/suspend.rs +++ b/yazi-actor/src/mgr/suspend.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Suspend; impl Actor for Suspend { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "suspend"; - fn act(_: &mut Ctx, _: Self::Options) -> Result { + fn act(_: &mut Ctx, _: Self::Form) -> Result { #[cfg(unix)] if !yazi_shared::session_leader() { unsafe { diff --git a/yazi-actor/src/mgr/tab_close.rs b/yazi-actor/src/mgr/tab_close.rs index fe1da4e8..cc4ad9d9 100644 --- a/yazi-actor/src/mgr/tab_close.rs +++ b/yazi-actor/src/mgr/tab_close.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::TabCloseOpt; +use yazi_parser::mgr::TabCloseForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct TabClose; impl Actor for TabClose { - type Options = TabCloseOpt; + type Form = TabCloseForm; const NAME: &str = "tab_close"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let len = cx.tabs().len(); if len < 2 || opt.idx >= len { succ!(); diff --git a/yazi-actor/src/mgr/tab_create.rs b/yazi-actor/src/mgr/tab_create.rs index f5f78bab..1d807170 100644 --- a/yazi-actor/src/mgr/tab_create.rs +++ b/yazi-actor/src/mgr/tab_create.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::tab::Tab; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::{CdSource, TabCreateOpt}; +use yazi_parser::mgr::{CdSource, TabCreateForm}; use yazi_scheduler::NotifyProxy; use yazi_shared::{data::Data, url::UrlLike}; @@ -12,11 +12,11 @@ const MAX_TABS: usize = 9; pub struct TabCreate; impl Actor for TabCreate { - type Options = TabCreateOpt; + type Form = TabCreateForm; const NAME: &str = "tab_create"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { if cx.tabs().len() >= MAX_TABS { succ!(NotifyProxy::push_warn( "Too many tabs", diff --git a/yazi-actor/src/mgr/tab_rename.rs b/yazi-actor/src/mgr/tab_rename.rs index 8a973a28..d2a32e56 100644 --- a/yazi-actor/src/mgr/tab_rename.rs +++ b/yazi-actor/src/mgr/tab_rename.rs @@ -3,7 +3,7 @@ use std::borrow::Cow; use anyhow::Result; use yazi_config::popup::InputCfg; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::TabRenameOpt; +use yazi_parser::mgr::TabRenameForm; use yazi_proxy::{InputProxy, MgrProxy}; use yazi_shared::data::Data; use yazi_widgets::input::InputEvent; @@ -13,11 +13,11 @@ use crate::{Actor, Ctx}; pub struct TabRename; impl Actor for TabRename { - type Options = TabRenameOpt; + type Form = TabRenameForm; const NAME: &str = "tab_rename"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tab = cx.tab().id; let pref = &mut cx.tab_mut().pref; diff --git a/yazi-actor/src/mgr/tab_swap.rs b/yazi-actor/src/mgr/tab_swap.rs index 6b4eaed2..73df8bc7 100644 --- a/yazi-actor/src/mgr/tab_swap.rs +++ b/yazi-actor/src/mgr/tab_swap.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_dds::Pubsub; use yazi_macro::{err, render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct TabSwap; impl Actor for TabSwap { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "tab_swap"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tabs = cx.tabs_mut(); let new = opt.step.add(tabs.cursor, tabs.len(), 0); diff --git a/yazi-actor/src/mgr/tab_switch.rs b/yazi-actor/src/mgr/tab_switch.rs index aff75496..9230b727 100644 --- a/yazi-actor/src/mgr/tab_switch.rs +++ b/yazi-actor/src/mgr/tab_switch.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::TabSwitchOpt; +use yazi_parser::mgr::TabSwitchForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct TabSwitch; impl Actor for TabSwitch { - type Options = TabSwitchOpt; + type Form = TabSwitchForm; const NAME: &str = "tab_switch"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tabs = cx.tabs_mut(); let idx = if opt.relative { opt.step.saturating_add_unsigned(tabs.cursor).rem_euclid(tabs.len() as _) as _ diff --git a/yazi-actor/src/mgr/toggle.rs b/yazi-actor/src/mgr/toggle.rs index 39314078..ec08d508 100644 --- a/yazi-actor/src/mgr/toggle.rs +++ b/yazi-actor/src/mgr/toggle.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render_and, succ}; -use yazi_parser::mgr::ToggleOpt; +use yazi_parser::mgr::ToggleForm; use yazi_scheduler::NotifyProxy; use yazi_shared::{data::Data, url::UrlCow}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Toggle; impl Actor for Toggle { - type Options = ToggleOpt; + type Form = ToggleForm; const NAME: &str = "toggle"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tab = cx.tab_mut(); let Some(url) = opt.url.or(tab.current.hovered().map(|h| UrlCow::from(&h.url))) else { succ!(); diff --git a/yazi-actor/src/mgr/toggle_all.rs b/yazi-actor/src/mgr/toggle_all.rs index 5e4b3acd..239f7003 100644 --- a/yazi-actor/src/mgr/toggle_all.rs +++ b/yazi-actor/src/mgr/toggle_all.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::mgr::ToggleAllOpt; +use yazi_parser::mgr::ToggleAllForm; use yazi_scheduler::NotifyProxy; use yazi_shared::data::Data; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct ToggleAll; impl Actor for ToggleAll { - type Options = ToggleAllOpt; + type Form = ToggleAllForm; const NAME: &str = "toggle_all"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { use either::Either::*; let tab = cx.tab_mut(); diff --git a/yazi-actor/src/mgr/unyank.rs b/yazi-actor/src/mgr/unyank.rs index 0f3fb723..c15aa28a 100644 --- a/yazi-actor/src/mgr/unyank.rs +++ b/yazi-actor/src/mgr/unyank.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Unyank; impl Actor for Unyank { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "unyank"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let repeek = cx.hovered().is_some_and(|f| f.is_dir() && cx.mgr.yanked.contains_in(&f.url)); cx.mgr.yanked.clear(); diff --git a/yazi-actor/src/mgr/update_files.rs b/yazi-actor/src/mgr/update_files.rs index da8fc4e5..f4918eef 100644 --- a/yazi-actor/src/mgr/update_files.rs +++ b/yazi-actor/src/mgr/update_files.rs @@ -2,7 +2,7 @@ use anyhow::Result; use yazi_core::tab::Folder; use yazi_fs::FilesOp; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::UpdateFilesOpt; +use yazi_parser::mgr::UpdateFilesForm; use yazi_shared::{data::Data, url::UrlLike}; use yazi_watcher::local::LINKED; @@ -11,11 +11,11 @@ use crate::{Actor, Ctx}; pub struct UpdateFiles; impl Actor for UpdateFiles { - type Options = UpdateFilesOpt; + type Form = UpdateFilesForm; const NAME: &str = "update_files"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let revision = cx.current().files.revision; let linked: Vec<_> = LINKED.read().from_dir(opt.op.cwd()).map(|u| opt.op.chdir(u)).collect(); diff --git a/yazi-actor/src/mgr/update_mimes.rs b/yazi-actor/src/mgr/update_mimes.rs index 539e55fe..2ed894e9 100644 --- a/yazi-actor/src/mgr/update_mimes.rs +++ b/yazi-actor/src/mgr/update_mimes.rs @@ -1,7 +1,7 @@ use anyhow::Result; use hashbrown::HashMap; use yazi_macro::{act, render, succ}; -use yazi_parser::mgr::UpdateMimesOpt; +use yazi_parser::mgr::UpdateMimesForm; use yazi_shared::{data::Data, pool::InternStr, url::{AsUrl, UrlCov}}; use yazi_watcher::local::LINKED; @@ -10,11 +10,11 @@ use crate::{Actor, Ctx}; pub struct UpdateMimes; impl Actor for UpdateMimes { - type Options = UpdateMimesOpt; + type Form = UpdateMimesForm; const NAME: &str = "update_mimes"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let linked = LINKED.read(); let updates = opt .updates diff --git a/yazi-actor/src/mgr/update_paged.rs b/yazi-actor/src/mgr/update_paged.rs index f2188215..adff2853 100644 --- a/yazi-actor/src/mgr/update_paged.rs +++ b/yazi-actor/src/mgr/update_paged.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::mgr::UpdatePagedOpt; +use yazi_parser::mgr::UpdatePagedForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct UpdatePaged; impl Actor for UpdatePaged { - type Options = UpdatePagedOpt; + type Form = UpdatePagedForm; const NAME: &str = "update_paged"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { if opt.only_if.is_some_and(|u| u != *cx.cwd()) { succ!(); } diff --git a/yazi-actor/src/mgr/update_peeked.rs b/yazi-actor/src/mgr/update_peeked.rs index 499e3669..150ae25e 100644 --- a/yazi-actor/src/mgr/update_peeked.rs +++ b/yazi-actor/src/mgr/update_peeked.rs @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct UpdatePeeked; impl Actor for UpdatePeeked { - type Options = UpdatePeekedForm; + type Form = UpdatePeekedForm; const NAME: &str = "update_peeked"; - fn act(cx: &mut Ctx, form: Self::Options) -> Result { + fn act(cx: &mut Ctx, form: Self::Form) -> Result { let Some(hovered) = cx.hovered().map(|h| &h.url) else { succ!(cx.tab_mut().preview.reset()); }; diff --git a/yazi-actor/src/mgr/update_spotted.rs b/yazi-actor/src/mgr/update_spotted.rs index ad3471c1..4f0f23ad 100644 --- a/yazi-actor/src/mgr/update_spotted.rs +++ b/yazi-actor/src/mgr/update_spotted.rs @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct UpdateSpotted; impl Actor for UpdateSpotted { - type Options = UpdateSpottedForm; + type Form = UpdateSpottedForm; const NAME: &str = "update_spotted"; - fn act(cx: &mut Ctx, mut form: Self::Options) -> Result { + fn act(cx: &mut Ctx, mut form: Self::Form) -> Result { let tab = cx.tab_mut(); let Some(hovered) = tab.hovered().map(|h| &h.url) else { succ!(tab.spot.reset()); diff --git a/yazi-actor/src/mgr/update_yanked.rs b/yazi-actor/src/mgr/update_yanked.rs index 77f31174..d2485d46 100644 --- a/yazi-actor/src/mgr/update_yanked.rs +++ b/yazi-actor/src/mgr/update_yanked.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::mgr::Yanked; use yazi_macro::{render, succ}; -use yazi_parser::mgr::UpdateYankedOpt; +use yazi_parser::mgr::UpdateYankedForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct UpdateYanked; impl Actor for UpdateYanked { - type Options = UpdateYankedOpt<'static>; + type Form = UpdateYankedForm<'static>; const NAME: &str = "update_yanked"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { if opt.urls.is_empty() && cx.mgr.yanked.is_empty() { succ!(); } diff --git a/yazi-actor/src/mgr/upload.rs b/yazi-actor/src/mgr/upload.rs index 4e01e6b3..93cd8fd5 100644 --- a/yazi-actor/src/mgr/upload.rs +++ b/yazi-actor/src/mgr/upload.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::mgr::UploadOpt; +use yazi_parser::mgr::UploadForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Upload; impl Actor for Upload { - type Options = UploadOpt; + type Form = UploadForm; const NAME: &str = "upload"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { for url in opt.urls { cx.tasks.scheduler.file_upload(url.into_owned()); } diff --git a/yazi-actor/src/mgr/visual_mode.rs b/yazi-actor/src/mgr/visual_mode.rs index e805a96f..e30a4b65 100644 --- a/yazi-actor/src/mgr/visual_mode.rs +++ b/yazi-actor/src/mgr/visual_mode.rs @@ -3,7 +3,7 @@ use std::collections::BTreeSet; use anyhow::Result; use yazi_core::tab::Mode; use yazi_macro::{render, succ}; -use yazi_parser::mgr::VisualModeOpt; +use yazi_parser::mgr::VisualModeForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -11,11 +11,11 @@ use crate::{Actor, Ctx}; pub struct VisualMode; impl Actor for VisualMode { - type Options = VisualModeOpt; + type Form = VisualModeForm; const NAME: &str = "visual_mode"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tab = cx.tab_mut(); let idx = tab.current.cursor; diff --git a/yazi-actor/src/mgr/watch.rs b/yazi-actor/src/mgr/watch.rs index 48c28fef..d1dcea18 100644 --- a/yazi-actor/src/mgr/watch.rs +++ b/yazi-actor/src/mgr/watch.rs @@ -2,7 +2,7 @@ use std::iter; use anyhow::Result; use yazi_macro::succ; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -10,11 +10,11 @@ use crate::{Actor, Ctx}; pub struct Watch; impl Actor for Watch { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "watch"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let it = iter::once(cx.core.mgr.tabs.active().cwd()) .chain(cx.core.mgr.tabs.parent().map(|p| &p.url)) .chain(cx.core.mgr.tabs.hovered().filter(|h| h.is_dir()).map(|h| &h.url)); diff --git a/yazi-actor/src/mgr/yank.rs b/yazi-actor/src/mgr/yank.rs index 6ba2569a..21c9ca1e 100644 --- a/yazi-actor/src/mgr/yank.rs +++ b/yazi-actor/src/mgr/yank.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::mgr::Yanked; use yazi_macro::{act, render}; -use yazi_parser::mgr::YankOpt; +use yazi_parser::mgr::YankForm; use yazi_shared::{data::Data, url::UrlBufCov}; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Yank; impl Actor for Yank { - type Options = YankOpt; + type Form = YankForm; const NAME: &str = "yank"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(mgr:escape_visual, cx)?; cx.mgr.yanked = diff --git a/yazi-actor/src/notify/push.rs b/yazi-actor/src/notify/push.rs index 90274661..ff7f82cf 100644 --- a/yazi-actor/src/notify/push.rs +++ b/yazi-actor/src/notify/push.rs @@ -11,11 +11,11 @@ use crate::{Actor, Ctx}; pub struct Push; impl Actor for Push { - type Options = PushForm; + type Form = PushForm; const NAME: &str = "push"; - fn act(cx: &mut Ctx, form: Self::Options) -> Result { + fn act(cx: &mut Ctx, form: Self::Form) -> Result { let instant = Instant::now(); let mut msg = Message::from(form.opt); @@ -28,7 +28,7 @@ impl Actor for Push { succ!(); } - fn hook(cx: &Ctx, _: &Self::Options) -> Option { + fn hook(cx: &Ctx, _: &Self::Form) -> Option { match cx.source() { Source::Relay => Some(SparkKind::RelayNotifyPush), _ => None, diff --git a/yazi-actor/src/notify/tick.rs b/yazi-actor/src/notify/tick.rs index 5575713c..950555c2 100644 --- a/yazi-actor/src/notify/tick.rs +++ b/yazi-actor/src/notify/tick.rs @@ -5,7 +5,7 @@ use ratatui::layout::Rect; use yazi_core::notify::Notify; use yazi_emulator::Dimension; use yazi_macro::{render, render_partial, succ}; -use yazi_parser::notify::TickOpt; +use yazi_parser::notify::TickForm; use yazi_proxy::NotifyProxy; use yazi_shared::data::Data; @@ -14,11 +14,11 @@ use crate::{Actor, Ctx}; pub struct Tick; impl Actor for Tick { - type Options = TickOpt; + type Form = TickForm; const NAME: &str = "tick"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { cx.notify.ticker.take().map(|h| h.abort()); let Dimension { rows, columns, .. } = Dimension::available(); diff --git a/yazi-actor/src/pick/arrow.rs b/yazi-actor/src/pick/arrow.rs index 0dbbdd27..bb88b165 100644 --- a/yazi-actor/src/pick/arrow.rs +++ b/yazi-actor/src/pick/arrow.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use yazi_widgets::Scrollable; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Arrow; impl Actor for Arrow { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { succ!(render!(cx.pick.scroll(opt.step))); } } diff --git a/yazi-actor/src/pick/close.rs b/yazi-actor/src/pick/close.rs index 02596f6b..7c02a0e0 100644 --- a/yazi-actor/src/pick/close.rs +++ b/yazi-actor/src/pick/close.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{render, succ}; -use yazi_parser::pick::CloseOpt; +use yazi_parser::pick::CloseForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Close; impl Actor for Close { - type Options = CloseOpt; + type Form = CloseForm; const NAME: &str = "close"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let pick = &mut cx.pick; if let Some(cb) = pick.callback.take() { _ = cb.send(if opt.submit { Some(pick.cursor) } else { None }); diff --git a/yazi-actor/src/pick/show.rs b/yazi-actor/src/pick/show.rs index 8eecc38c..b509acbf 100644 --- a/yazi-actor/src/pick/show.rs +++ b/yazi-actor/src/pick/show.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::pick::ShowOpt; +use yazi_parser::pick::ShowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Show; impl Actor for Show { - type Options = ShowOpt; + type Form = ShowForm; const NAME: &str = "show"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(pick:close, cx)?; let pick = &mut cx.pick; diff --git a/yazi-actor/src/spot/arrow.rs b/yazi-actor/src/spot/arrow.rs index 5e2d3b7c..e1eb0b51 100644 --- a/yazi-actor/src/spot/arrow.rs +++ b/yazi-actor/src/spot/arrow.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Arrow; impl Actor for Arrow { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let spot = &mut cx.tab_mut().spot; let Some(lock) = &mut spot.lock else { succ!() }; diff --git a/yazi-actor/src/spot/close.rs b/yazi-actor/src/spot/close.rs index d7656f43..ec405a96 100644 --- a/yazi-actor/src/spot/close.rs +++ b/yazi-actor/src/spot/close.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Close; impl Actor for Close { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "close"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { succ!(cx.tab_mut().spot.reset()); } } diff --git a/yazi-actor/src/spot/copy.rs b/yazi-actor/src/spot/copy.rs index 65ea3e4a..c04294b7 100644 --- a/yazi-actor/src/spot/copy.rs +++ b/yazi-actor/src/spot/copy.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::spot::CopyOpt; +use yazi_parser::spot::CopyForm; use yazi_shared::data::Data; use yazi_widgets::CLIPBOARD; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Copy; impl Actor for Copy { - type Options = CopyOpt; + type Form = CopyForm; const NAME: &str = "copy"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let spot = &cx.tab().spot; let Some(lock) = &spot.lock else { succ!() }; let Some(table) = lock.table() else { succ!() }; diff --git a/yazi-actor/src/spot/swipe.rs b/yazi-actor/src/spot/swipe.rs index f46c9d02..5bf195cf 100644 --- a/yazi-actor/src/spot/swipe.rs +++ b/yazi-actor/src/spot/swipe.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::act; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Swipe; impl Actor for Swipe { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "swipe"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { act!(mgr:arrow, cx, opt)?; act!(mgr:spot, cx) } diff --git a/yazi-actor/src/tasks/arrow.rs b/yazi-actor/src/tasks/arrow.rs index 66eccbd9..6687ced3 100644 --- a/yazi-actor/src/tasks/arrow.rs +++ b/yazi-actor/src/tasks/arrow.rs @@ -1,7 +1,7 @@ use anyhow::Result; use yazi_core::tasks::Tasks; use yazi_macro::{render, succ}; -use yazi_parser::ArrowOpt; +use yazi_parser::ArrowForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Arrow; impl Actor for Arrow { - type Options = ArrowOpt; + type Form = ArrowForm; const NAME: &str = "arrow"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { let tasks = &mut cx.tasks; let old = tasks.cursor; diff --git a/yazi-actor/src/tasks/cancel.rs b/yazi-actor/src/tasks/cancel.rs index ec137486..3e39a7ba 100644 --- a/yazi-actor/src/tasks/cancel.rs +++ b/yazi-actor/src/tasks/cancel.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Cancel; impl Actor for Cancel { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "cancel"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let tasks = &mut cx.tasks; let id = tasks.scheduler.ongoing.lock().get_id(tasks.cursor); diff --git a/yazi-actor/src/tasks/close.rs b/yazi-actor/src/tasks/close.rs index bf0f87ef..6635d0da 100644 --- a/yazi-actor/src/tasks/close.rs +++ b/yazi-actor/src/tasks/close.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Close; impl Actor for Close { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "close"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let tasks = &mut cx.tasks; if !tasks.visible { succ!(); diff --git a/yazi-actor/src/tasks/inspect.rs b/yazi-actor/src/tasks/inspect.rs index e4a4bc7d..781c7257 100644 --- a/yazi-actor/src/tasks/inspect.rs +++ b/yazi-actor/src/tasks/inspect.rs @@ -6,7 +6,7 @@ use scopeguard::defer; use tokio::{io::{AsyncReadExt, stdin}, select, sync::mpsc, time}; use yazi_binding::Permit; use yazi_macro::succ; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_scheduler::AppProxy; use yazi_shared::{data::Data, terminal_clear}; use yazi_term::YIELD_TO_SUBPROCESS; @@ -17,11 +17,11 @@ use crate::{Actor, Ctx}; pub struct Inspect; impl Actor for Inspect { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "inspect"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let ongoing = cx.tasks.scheduler.ongoing.clone(); let Some(id) = ongoing.lock().get_id(cx.tasks.cursor) else { succ!(); diff --git a/yazi-actor/src/tasks/open_shell_compat.rs b/yazi-actor/src/tasks/open_shell_compat.rs index 0cc0f1cb..ff1fb3c1 100644 --- a/yazi-actor/src/tasks/open_shell_compat.rs +++ b/yazi-actor/src/tasks/open_shell_compat.rs @@ -9,11 +9,11 @@ pub struct OpenShellCompat; // TODO: remove impl Actor for OpenShellCompat { - type Options = ProcessOpenForm; + type Form = ProcessOpenForm; const NAME: &str = "open_shell_compat"; - fn act(cx: &mut Ctx, Self::Options { opt, .. }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { opt, .. }: Self::Form) -> Result { succ!(cx.tasks.open_shell_compat(opt)); } } diff --git a/yazi-actor/src/tasks/process_open.rs b/yazi-actor/src/tasks/process_open.rs index ffa61184..519d8aaa 100644 --- a/yazi-actor/src/tasks/process_open.rs +++ b/yazi-actor/src/tasks/process_open.rs @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct ProcessOpen; impl Actor for ProcessOpen { - type Options = ProcessOpenForm; + type Form = ProcessOpenForm; const NAME: &str = "process_open"; - fn act(cx: &mut Ctx, form: Self::Options) -> Result { + fn act(cx: &mut Ctx, form: Self::Form) -> Result { let done = cx.tasks.scheduler.process_open(form.opt); if let Some(replier) = form.replier { diff --git a/yazi-actor/src/tasks/show.rs b/yazi-actor/src/tasks/show.rs index 1827b265..f1b4026e 100644 --- a/yazi-actor/src/tasks/show.rs +++ b/yazi-actor/src/tasks/show.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::{act, render, succ}; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Show; impl Actor for Show { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "show"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { let tasks = &mut cx.tasks; if tasks.visible { succ!(); diff --git a/yazi-actor/src/tasks/update_succeed.rs b/yazi-actor/src/tasks/update_succeed.rs index 21e0ebd4..2bd31d43 100644 --- a/yazi-actor/src/tasks/update_succeed.rs +++ b/yazi-actor/src/tasks/update_succeed.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::tasks::UpdateSucceedOpt; +use yazi_parser::tasks::UpdateSucceedForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct UpdateSucceed; impl Actor for UpdateSucceed { - type Options = UpdateSucceedOpt; + type Form = UpdateSucceedForm; const NAME: &str = "update_succeed"; - fn act(cx: &mut Ctx, opt: Self::Options) -> Result { + fn act(cx: &mut Ctx, opt: Self::Form) -> Result { if opt.urls.is_empty() { succ!(); } diff --git a/yazi-actor/src/which/activate.rs b/yazi-actor/src/which/activate.rs index fd975825..4cf42b3d 100644 --- a/yazi-actor/src/which/activate.rs +++ b/yazi-actor/src/which/activate.rs @@ -9,11 +9,11 @@ use crate::{Actor, Ctx}; pub struct Activate; impl Actor for Activate { - type Options = ActivateForm; + type Form = ActivateForm; const NAME: &str = "activate"; - fn act(cx: &mut Ctx, Self::Options { mut opt }: Self::Options) -> Result { + fn act(cx: &mut Ctx, Self::Form { mut opt }: Self::Form) -> Result { opt.cands.retain(|c| c.on.len() > opt.times); WhichSorter::default().sort(&mut opt.cands); @@ -31,7 +31,7 @@ impl Actor for Activate { succ!(render!()); } - fn hook(cx: &Ctx, _opt: &Self::Options) -> Option { + fn hook(cx: &Ctx, _opt: &Self::Form) -> Option { match cx.source() { Source::Unknown => Some(SparkKind::IndWhichActivate), _ => None, diff --git a/yazi-actor/src/which/dismiss.rs b/yazi-actor/src/which/dismiss.rs index 1423c2cb..c26b4034 100644 --- a/yazi-actor/src/which/dismiss.rs +++ b/yazi-actor/src/which/dismiss.rs @@ -1,6 +1,6 @@ use anyhow::Result; use yazi_macro::succ; -use yazi_parser::VoidOpt; +use yazi_parser::VoidForm; use yazi_shared::data::Data; use crate::{Actor, Ctx}; @@ -8,11 +8,11 @@ use crate::{Actor, Ctx}; pub struct Dismiss; impl Actor for Dismiss { - type Options = VoidOpt; + type Form = VoidForm; const NAME: &str = "dismiss"; - fn act(cx: &mut Ctx, _: Self::Options) -> Result { + fn act(cx: &mut Ctx, _: Self::Form) -> Result { succ!(cx.which.dismiss(None)); } } diff --git a/yazi-binding/Cargo.toml b/yazi-binding/Cargo.toml index 0ab4ddcd..f28d6d9d 100644 --- a/yazi-binding/Cargo.toml +++ b/yazi-binding/Cargo.toml @@ -41,5 +41,11 @@ tokio-stream = { workspace = true } tracing = { workspace = true } unicode-width = { workspace = true } +[target.'cfg(unix)'.dependencies] +libc = { workspace = true } + [target.'cfg(target_os = "macos")'.dependencies] crossterm = { workspace = true, features = [ "use-dev-tty", "libc" ] } + +[target."cfg(windows)".dependencies] +windows-sys = { version = "0.61.2", features = [ "Win32_System_JobObjects" ] } diff --git a/yazi-binding/src/lib.rs b/yazi-binding/src/lib.rs index 29e2a050..f696a98b 100644 --- a/yazi-binding/src/lib.rs +++ b/yazi-binding/src/lib.rs @@ -1,5 +1,5 @@ mod macros; -yazi_macro::mod_pub!(elements); +yazi_macro::mod_pub!(elements process); yazi_macro::mod_flat!(access calculator cha chan chord_cow color composer error fd file handle icon id image input iter layer mouse path permit range runtime scheme stage style url utils); diff --git a/yazi-plugin/src/process/child.rs b/yazi-binding/src/process/child.rs similarity index 99% rename from yazi-plugin/src/process/child.rs rename to yazi-binding/src/process/child.rs index 593625a0..961cdcb9 100644 --- a/yazi-plugin/src/process/child.rs +++ b/yazi-binding/src/process/child.rs @@ -3,7 +3,7 @@ use std::{ops::DerefMut, process::ExitStatus, time::Duration}; use futures::future::try_join3; use mlua::{AnyUserData, ExternalError, IntoLua, IntoLuaMulti, Table, UserData, UserDataMethods, Value}; use tokio::{io::{self, AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, BufWriter}, process::{ChildStderr, ChildStdin, ChildStdout}, select}; -use yazi_binding::Error; +use crate::Error; use super::Status; use crate::process::Output; diff --git a/yazi-plugin/src/process/command.rs b/yazi-binding/src/process/command.rs similarity index 99% rename from yazi-plugin/src/process/command.rs rename to yazi-binding/src/process/command.rs index 1d57a01b..97fa5577 100644 --- a/yazi-plugin/src/process/command.rs +++ b/yazi-binding/src/process/command.rs @@ -2,7 +2,7 @@ use std::{any::TypeId, ffi::OsStr, io, process::Stdio}; use mlua::{AnyUserData, ExternalError, IntoLua, IntoLuaMulti, Lua, MetaMethod, Table, UserData, Value}; use tokio::process::{ChildStderr, ChildStdin, ChildStdout}; -use yazi_binding::Error; +use crate::Error; use yazi_shared::wtf8::FromWtf8; use super::{Child, output::Output}; diff --git a/yazi-plugin/src/process/mod.rs b/yazi-binding/src/process/mod.rs similarity index 100% rename from yazi-plugin/src/process/mod.rs rename to yazi-binding/src/process/mod.rs diff --git a/yazi-plugin/src/process/output.rs b/yazi-binding/src/process/output.rs similarity index 93% rename from yazi-plugin/src/process/output.rs rename to yazi-binding/src/process/output.rs index bbc5dda3..ad0a05ef 100644 --- a/yazi-plugin/src/process/output.rs +++ b/yazi-binding/src/process/output.rs @@ -1,7 +1,7 @@ use std::mem; use mlua::{UserData, Value}; -use yazi_binding::{cached_field, cached_field_mut}; +use crate::{cached_field, cached_field_mut}; use super::Status; diff --git a/yazi-plugin/src/process/process.rs b/yazi-binding/src/process/process.rs similarity index 100% rename from yazi-plugin/src/process/process.rs rename to yazi-binding/src/process/process.rs diff --git a/yazi-plugin/src/process/status.rs b/yazi-binding/src/process/status.rs similarity index 100% rename from yazi-plugin/src/process/status.rs rename to yazi-binding/src/process/status.rs diff --git a/yazi-core/src/cmp/mod.rs b/yazi-core/src/cmp/mod.rs index b3ab4cee..f0bb68fa 100644 --- a/yazi-core/src/cmp/mod.rs +++ b/yazi-core/src/cmp/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(cmp item opt); +yazi_macro::mod_flat!(cmp item option); diff --git a/yazi-core/src/cmp/opt.rs b/yazi-core/src/cmp/option.rs similarity index 100% rename from yazi-core/src/cmp/opt.rs rename to yazi-core/src/cmp/option.rs diff --git a/yazi-core/src/notify/mod.rs b/yazi-core/src/notify/mod.rs index e62af76c..fe7de288 100644 --- a/yazi-core/src/notify/mod.rs +++ b/yazi-core/src/notify/mod.rs @@ -1,4 +1,4 @@ -yazi_macro::mod_flat!(level message notify opt); +yazi_macro::mod_flat!(level message notify option); pub const NOTIFY_BORDER: u16 = 2; pub const NOTIFY_SPACING: u16 = 1; diff --git a/yazi-core/src/notify/opt.rs b/yazi-core/src/notify/option.rs similarity index 100% rename from yazi-core/src/notify/opt.rs rename to yazi-core/src/notify/option.rs diff --git a/yazi-core/src/which/mod.rs b/yazi-core/src/which/mod.rs index d9966ab6..63c8506e 100644 --- a/yazi-core/src/which/mod.rs +++ b/yazi-core/src/which/mod.rs @@ -1 +1 @@ -yazi_macro::mod_flat!(opt sorter which); +yazi_macro::mod_flat!(option sorter which); diff --git a/yazi-core/src/which/opt.rs b/yazi-core/src/which/option.rs similarity index 100% rename from yazi-core/src/which/opt.rs rename to yazi-core/src/which/option.rs diff --git a/yazi-fm/src/executor.rs b/yazi-fm/src/executor.rs index d9a0460b..06ac8071 100644 --- a/yazi-fm/src/executor.rs +++ b/yazi-fm/src/executor.rs @@ -51,14 +51,14 @@ impl<'a> Executor<'a> { match &*action.name { "resize" => act!(app:resize, cx, crate::Root::reflow as fn(_) -> _), - "resume" => act!(app:resume, cx, yazi_parser::app::ResumeOpt { + "resume" => act!(app:resume, cx, yazi_parser::app::ResumeForm { tx: self.app.signals.tx.clone(), - token: action.take_any("token").context("Invalid 'token' in ResumeOpt")?, + token: action.take_any("token").context("Invalid 'token' in ResumeForm")?, reflow: crate::Root::reflow, }), - "stop" => act!(app:stop, cx, yazi_parser::app::StopOpt { + "stop" => act!(app:stop, cx, yazi_parser::app::StopForm { tx: self.app.signals.tx.clone(), - token: action.take_any("token").context("Invalid 'token' in StopOpt")?, + token: action.take_any("token").context("Invalid 'token' in StopForm")?, }), _ => succ!(), } diff --git a/yazi-macro/src/actor.rs b/yazi-macro/src/actor.rs index 28ade8c7..3bbd65a4 100644 --- a/yazi-macro/src/actor.rs +++ b/yazi-macro/src/actor.rs @@ -25,12 +25,12 @@ macro_rules! act { }}; ($layer:ident : $name:ident, $cx:ident, $action:expr) => { - ::Options::try_from($action) + ::Form::try_from($action) .map_err(anyhow::Error::from) .and_then(|opt| act!(@impl $layer:$name, $cx, opt)) }; ($layer:ident : $name:ident, $cx:ident) => { - act!($layer:$name, $cx, <::Options as Default>::default()) + act!($layer:$name, $cx, <::Form as Default>::default()) }; ($layer:ident : $name:ident) => { paste::paste! { yazi_actor::$layer::[<$name:camel>] } diff --git a/yazi-parser/src/app/deprecate.rs b/yazi-parser/src/app/deprecate.rs index deb16820..67bc3cd4 100644 --- a/yazi-parser/src/app/deprecate.rs +++ b/yazi-parser/src/app/deprecate.rs @@ -3,26 +3,26 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{SStr, event::ActionCow}; #[derive(Debug)] -pub struct DeprecateOpt { +pub struct DeprecateForm { pub content: SStr, } -impl TryFrom for DeprecateOpt { +impl TryFrom for DeprecateForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Ok(content) = a.take("content") else { - bail!("Invalid 'content' in DeprecateOpt"); + bail!("Invalid 'content' in DeprecateForm"); }; Ok(Self { content }) } } -impl FromLua for DeprecateOpt { +impl FromLua for DeprecateForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for DeprecateOpt { +impl IntoLua for DeprecateForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/app/lua.rs b/yazi-parser/src/app/lua.rs index b6ece619..c183d6be 100644 --- a/yazi-parser/src/app/lua.rs +++ b/yazi-parser/src/app/lua.rs @@ -5,20 +5,20 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{SStr, event::ActionCow}; #[derive(Clone, Debug, Default)] -pub struct LuaOpt { +pub struct LuaForm { pub code: SStr, } -impl TryFrom for LuaOpt { +impl TryFrom for LuaForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { Ok(Self { code: a.take_first()? }) } } -impl FromLua for LuaOpt { +impl FromLua for LuaForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for LuaOpt { +impl IntoLua for LuaForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/app/mouse.rs b/yazi-parser/src/app/mouse.rs index 8eae8998..cc28a4dc 100644 --- a/yazi-parser/src/app/mouse.rs +++ b/yazi-parser/src/app/mouse.rs @@ -2,18 +2,18 @@ use crossterm::event::MouseEvent; use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; #[derive(Debug)] -pub struct MouseOpt { +pub struct MouseForm { pub event: MouseEvent, } -impl From for MouseOpt { +impl From for MouseForm { fn from(event: MouseEvent) -> Self { Self { event } } } -impl FromLua for MouseOpt { +impl FromLua for MouseForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for MouseOpt { +impl IntoLua for MouseForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/app/reflow.rs b/yazi-parser/src/app/reflow.rs index 3c9b80a2..ba4bc65c 100644 --- a/yazi-parser/src/app/reflow.rs +++ b/yazi-parser/src/app/reflow.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Table, Value}; use ratatui::layout::Rect; #[derive(Debug)] -pub struct ReflowOpt { +pub struct ReflowForm { pub reflow: fn(Rect) -> mlua::Result, } -impl From mlua::Result
> for ReflowOpt { +impl From mlua::Result
> for ReflowForm { fn from(f: fn(Rect) -> mlua::Result
) -> Self { Self { reflow: f } } } -impl FromLua for ReflowOpt { +impl FromLua for ReflowForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ReflowOpt { +impl IntoLua for ReflowForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/app/resume.rs b/yazi-parser/src/app/resume.rs index ea0c3f1e..53ba6581 100644 --- a/yazi-parser/src/app/resume.rs +++ b/yazi-parser/src/app/resume.rs @@ -4,16 +4,16 @@ use tokio::sync::mpsc; use yazi_shared::CompletionToken; #[derive(Debug)] -pub struct ResumeOpt { +pub struct ResumeForm { pub tx: mpsc::UnboundedSender<(bool, CompletionToken)>, pub token: CompletionToken, pub reflow: fn(Rect) -> mlua::Result
, } -impl FromLua for ResumeOpt { +impl FromLua for ResumeForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ResumeOpt { +impl IntoLua for ResumeForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/app/stop.rs b/yazi-parser/src/app/stop.rs index 9280df8d..0f39207d 100644 --- a/yazi-parser/src/app/stop.rs +++ b/yazi-parser/src/app/stop.rs @@ -3,15 +3,15 @@ use tokio::sync::mpsc; use yazi_shared::CompletionToken; #[derive(Debug)] -pub struct StopOpt { +pub struct StopForm { pub tx: mpsc::UnboundedSender<(bool, CompletionToken)>, pub token: CompletionToken, } -impl FromLua for StopOpt { +impl FromLua for StopForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for StopOpt { +impl IntoLua for StopForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/app/title.rs b/yazi-parser/src/app/title.rs index 4536a183..8e7f5d56 100644 --- a/yazi-parser/src/app/title.rs +++ b/yazi-parser/src/app/title.rs @@ -4,14 +4,14 @@ use yazi_binding::SER_OPT; use yazi_shared::SStr; #[derive(Debug, Default, Deserialize, Serialize)] -pub struct TitleOpt { +pub struct TitleForm { pub value: Option, } -impl FromLua for TitleOpt { +impl FromLua for TitleForm { fn from_lua(value: Value, lua: &Lua) -> mlua::Result { lua.from_value(value) } } -impl IntoLua for TitleOpt { +impl IntoLua for TitleForm { fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value_with(&self, SER_OPT) } } diff --git a/yazi-parser/src/app/update_progress.rs b/yazi-parser/src/app/update_progress.rs index fa5408e0..fa7d70b8 100644 --- a/yazi-parser/src/app/update_progress.rs +++ b/yazi-parser/src/app/update_progress.rs @@ -4,26 +4,26 @@ use yazi_scheduler::TaskSummary; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct UpdateProgressOpt { +pub struct UpdateProgressForm { pub summary: TaskSummary, } -impl TryFrom for UpdateProgressOpt { +impl TryFrom for UpdateProgressForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Some(summary) = a.take_any("summary") else { - bail!("Invalid 'summary' in UpdateProgressOpt"); + bail!("Invalid 'summary' in UpdateProgressForm"); }; Ok(Self { summary }) } } -impl FromLua for UpdateProgressOpt { +impl FromLua for UpdateProgressForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for UpdateProgressOpt { +impl IntoLua for UpdateProgressForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/arrow.rs b/yazi-parser/src/arrow.rs index 061286bb..f17edbdb 100644 --- a/yazi-parser/src/arrow.rs +++ b/yazi-parser/src/arrow.rs @@ -4,26 +4,26 @@ use yazi_shared::event::ActionCow; use yazi_widgets::Step; #[derive(Clone, Copy, Debug, Default)] -pub struct ArrowOpt { +pub struct ArrowForm { pub step: Step, } -impl TryFrom for ArrowOpt { +impl TryFrom for ArrowForm { type Error = anyhow::Error; fn try_from(a: ActionCow) -> Result { let Ok(step) = a.first() else { - bail!("Invalid 'step' in ArrowOpt"); + bail!("Invalid 'step' in ArrowForm"); }; Ok(Self { step }) } } -impl From for ArrowOpt { +impl From for ArrowForm { fn from(n: isize) -> Self { Self { step: n.into() } } } -impl IntoLua for ArrowOpt { +impl IntoLua for ArrowForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/cmp/close.rs b/yazi-parser/src/cmp/close.rs index 91a0d0b7..fc2065eb 100644 --- a/yazi-parser/src/cmp/close.rs +++ b/yazi-parser/src/cmp/close.rs @@ -2,22 +2,22 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug, Default)] -pub struct CloseOpt { +pub struct CloseForm { pub submit: bool, } -impl From for CloseOpt { +impl From for CloseForm { fn from(a: ActionCow) -> Self { Self { submit: a.bool("submit") } } } -impl From for CloseOpt { +impl From for CloseForm { fn from(submit: bool) -> Self { Self { submit } } } -impl FromLua for CloseOpt { +impl FromLua for CloseForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CloseOpt { +impl IntoLua for CloseForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/cmp/trigger.rs b/yazi-parser/src/cmp/trigger.rs index 92f7b793..c043ba25 100644 --- a/yazi-parser/src/cmp/trigger.rs +++ b/yazi-parser/src/cmp/trigger.rs @@ -2,21 +2,21 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{Id, SStr, event::ActionCow}; #[derive(Debug)] -pub struct TriggerOpt { +pub struct TriggerForm { pub word: SStr, pub ticket: Option, } -impl From for TriggerOpt { +impl From for TriggerForm { fn from(mut a: ActionCow) -> Self { Self { word: a.take_first().unwrap_or_default(), ticket: a.get("ticket").ok() } } } -impl FromLua for TriggerOpt { +impl FromLua for TriggerForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for TriggerOpt { +impl IntoLua for TriggerForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/confirm/close.rs b/yazi-parser/src/confirm/close.rs index 91a0d0b7..fc2065eb 100644 --- a/yazi-parser/src/confirm/close.rs +++ b/yazi-parser/src/confirm/close.rs @@ -2,22 +2,22 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug, Default)] -pub struct CloseOpt { +pub struct CloseForm { pub submit: bool, } -impl From for CloseOpt { +impl From for CloseForm { fn from(a: ActionCow) -> Self { Self { submit: a.bool("submit") } } } -impl From for CloseOpt { +impl From for CloseForm { fn from(submit: bool) -> Self { Self { submit } } } -impl FromLua for CloseOpt { +impl FromLua for CloseForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CloseOpt { +impl IntoLua for CloseForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/confirm/show.rs b/yazi-parser/src/confirm/show.rs index 8e4a8f93..0275ea95 100644 --- a/yazi-parser/src/confirm/show.rs +++ b/yazi-parser/src/confirm/show.rs @@ -4,35 +4,35 @@ use yazi_config::popup::ConfirmCfg; use yazi_shared::{CompletionToken, event::ActionCow}; #[derive(Debug)] -pub struct ShowOpt { +pub struct ShowForm { pub cfg: ConfirmCfg, pub token: CompletionToken, } -impl TryFrom for ShowOpt { +impl TryFrom for ShowForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Some(cfg) = a.take_any("cfg") else { - bail!("Invalid 'cfg' in ShowOpt"); + bail!("Invalid 'cfg' in ShowForm"); }; let Some(token) = a.take_any("token") else { - bail!("Invalid 'token' in ShowOpt"); + bail!("Invalid 'token' in ShowForm"); }; Ok(Self { cfg, token }) } } -impl From> for ShowOpt { +impl From> for ShowForm { fn from(value: Box) -> Self { *value } } -impl FromLua for ShowOpt { +impl FromLua for ShowForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ShowOpt { +impl IntoLua for ShowForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/help/toggle.rs b/yazi-parser/src/help/toggle.rs index 31c8a823..aaee10b2 100644 --- a/yazi-parser/src/help/toggle.rs +++ b/yazi-parser/src/help/toggle.rs @@ -2,24 +2,24 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{Layer, event::ActionCow}; #[derive(Debug)] -pub struct ToggleOpt { +pub struct ToggleForm { pub layer: Layer, } -impl TryFrom for ToggleOpt { +impl TryFrom for ToggleForm { type Error = anyhow::Error; fn try_from(a: ActionCow) -> Result { Ok(Self { layer: a.str(0).parse()? }) } } -impl From for ToggleOpt { +impl From for ToggleForm { fn from(layer: Layer) -> Self { Self { layer } } } -impl FromLua for ToggleOpt { +impl FromLua for ToggleForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ToggleOpt { +impl IntoLua for ToggleForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/input/close.rs b/yazi-parser/src/input/close.rs index 91a0d0b7..fc2065eb 100644 --- a/yazi-parser/src/input/close.rs +++ b/yazi-parser/src/input/close.rs @@ -2,22 +2,22 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug, Default)] -pub struct CloseOpt { +pub struct CloseForm { pub submit: bool, } -impl From for CloseOpt { +impl From for CloseForm { fn from(a: ActionCow) -> Self { Self { submit: a.bool("submit") } } } -impl From for CloseOpt { +impl From for CloseForm { fn from(submit: bool) -> Self { Self { submit } } } -impl FromLua for CloseOpt { +impl FromLua for CloseForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CloseOpt { +impl IntoLua for CloseForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/bulk_exit.rs b/yazi-parser/src/mgr/bulk_exit.rs index 3372b902..41c205b6 100644 --- a/yazi-parser/src/mgr/bulk_exit.rs +++ b/yazi-parser/src/mgr/bulk_exit.rs @@ -3,27 +3,27 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlCow}; #[derive(Debug)] -pub struct BulkExitOpt { +pub struct BulkExitForm { pub target: UrlCow<'static>, pub accept: bool, } -impl TryFrom for BulkExitOpt { +impl TryFrom for BulkExitForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Ok(target) = a.take_first::() else { - bail!("invalid target in BulkExitOpt"); + bail!("invalid target in BulkExitForm"); }; Ok(Self { target, accept: a.bool("accept") }) } } -impl FromLua for BulkExitOpt { +impl FromLua for BulkExitForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for BulkExitOpt { +impl IntoLua for BulkExitForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/cd.rs b/yazi-parser/src/mgr/cd.rs index ae85b24e..6d3ac772 100644 --- a/yazi-parser/src/mgr/cd.rs +++ b/yazi-parser/src/mgr/cd.rs @@ -5,13 +5,13 @@ use yazi_shared::{event::ActionCow, url::{Url, UrlBuf}}; use yazi_vfs::provider; #[derive(Debug)] -pub struct CdOpt { +pub struct CdForm { pub target: UrlBuf, pub interactive: bool, pub source: CdSource, } -impl From for CdOpt { +impl From for CdForm { fn from(mut a: ActionCow) -> Self { let mut target = a.take_first().unwrap_or_default(); @@ -33,21 +33,21 @@ impl From for CdOpt { } } -impl From<(UrlBuf, CdSource)> for CdOpt { +impl From<(UrlBuf, CdSource)> for CdForm { fn from((target, source): (UrlBuf, CdSource)) -> Self { Self { target, interactive: false, source } } } -impl From<(Url<'_>, CdSource)> for CdOpt { +impl From<(Url<'_>, CdSource)> for CdForm { fn from((target, source): (Url, CdSource)) -> Self { Self::from((target.to_owned(), source)) } } -impl FromLua for CdOpt { +impl FromLua for CdForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CdOpt { +impl IntoLua for CdForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/copy.rs b/yazi-parser/src/mgr/copy.rs index 52f8f733..48876ce5 100644 --- a/yazi-parser/src/mgr/copy.rs +++ b/yazi-parser/src/mgr/copy.rs @@ -5,13 +5,13 @@ use serde::Deserialize; use yazi_shared::{SStr, event::ActionCow, strand::AsStrand}; #[derive(Debug)] -pub struct CopyOpt { +pub struct CopyForm { pub r#type: SStr, pub separator: CopySeparator, pub hovered: bool, } -impl From for CopyOpt { +impl From for CopyForm { fn from(mut a: ActionCow) -> Self { Self { r#type: a.take_first().unwrap_or_default(), @@ -21,11 +21,11 @@ impl From for CopyOpt { } } -impl FromLua for CopyOpt { +impl FromLua for CopyForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CopyOpt { +impl IntoLua for CopyForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/create.rs b/yazi-parser/src/mgr/create.rs index 72f9392e..5b38885e 100644 --- a/yazi-parser/src/mgr/create.rs +++ b/yazi-parser/src/mgr/create.rs @@ -2,19 +2,19 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct CreateOpt { +pub struct CreateForm { pub dir: bool, pub force: bool, } -impl From for CreateOpt { +impl From for CreateForm { fn from(a: ActionCow) -> Self { Self { dir: a.bool("dir"), force: a.bool("force") } } } -impl FromLua for CreateOpt { +impl FromLua for CreateForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CreateOpt { +impl IntoLua for CreateForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/download.rs b/yazi-parser/src/mgr/download.rs index b5d699b9..4d0016c9 100644 --- a/yazi-parser/src/mgr/download.rs +++ b/yazi-parser/src/mgr/download.rs @@ -2,19 +2,19 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlCow}; #[derive(Debug, Default)] -pub struct DownloadOpt { +pub struct DownloadForm { pub urls: Vec>, pub open: bool, } -impl From for DownloadOpt { +impl From for DownloadForm { fn from(mut a: ActionCow) -> Self { Self { urls: a.take_seq(), open: a.bool("open") } } } -impl FromLua for DownloadOpt { +impl FromLua for DownloadForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for DownloadOpt { +impl IntoLua for DownloadForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/escape.rs b/yazi-parser/src/mgr/escape.rs index 953c06e1..5e222c09 100644 --- a/yazi-parser/src/mgr/escape.rs +++ b/yazi-parser/src/mgr/escape.rs @@ -4,7 +4,7 @@ use yazi_shared::event::ActionCow; bitflags! { #[derive(Debug)] - pub struct EscapeOpt: u8 { + pub struct EscapeForm: u8 { const FIND = 0b00001; const VISUAL = 0b00010; const FILTER = 0b00100; @@ -13,7 +13,7 @@ bitflags! { } } -impl From for EscapeOpt { +impl From for EscapeForm { fn from(a: ActionCow) -> Self { a.args.iter().fold(Self::empty(), |acc, (k, v)| { match (k.as_str().unwrap_or(""), v.try_into().unwrap_or(false)) { @@ -29,10 +29,10 @@ impl From for EscapeOpt { } } -impl FromLua for EscapeOpt { +impl FromLua for EscapeForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for EscapeOpt { +impl IntoLua for EscapeForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/find.rs b/yazi-parser/src/mgr/find.rs index deb172e4..6a251e89 100644 --- a/yazi-parser/src/mgr/find.rs +++ b/yazi-parser/src/mgr/find.rs @@ -3,12 +3,12 @@ use yazi_fs::FilterCase; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct FindOpt { +pub struct FindForm { pub prev: bool, pub case: FilterCase, } -impl TryFrom for FindOpt { +impl TryFrom for FindForm { type Error = anyhow::Error; fn try_from(a: ActionCow) -> Result { @@ -16,10 +16,10 @@ impl TryFrom for FindOpt { } } -impl FromLua for FindOpt { +impl FromLua for FindForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for FindOpt { +impl IntoLua for FindForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/find_arrow.rs b/yazi-parser/src/mgr/find_arrow.rs index ff93827c..c4fd97d8 100644 --- a/yazi-parser/src/mgr/find_arrow.rs +++ b/yazi-parser/src/mgr/find_arrow.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct FindArrowOpt { +pub struct FindArrowForm { pub prev: bool, } -impl From for FindArrowOpt { +impl From for FindArrowForm { fn from(a: ActionCow) -> Self { Self { prev: a.bool("previous") } } } -impl FromLua for FindArrowOpt { +impl FromLua for FindArrowForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for FindArrowOpt { +impl IntoLua for FindArrowForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/hardlink.rs b/yazi-parser/src/mgr/hardlink.rs index 98287a06..857a609f 100644 --- a/yazi-parser/src/mgr/hardlink.rs +++ b/yazi-parser/src/mgr/hardlink.rs @@ -2,19 +2,19 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct HardlinkOpt { +pub struct HardlinkForm { pub force: bool, pub follow: bool, } -impl From for HardlinkOpt { +impl From for HardlinkForm { fn from(a: ActionCow) -> Self { Self { force: a.bool("force"), follow: a.bool("follow") } } } -impl FromLua for HardlinkOpt { +impl FromLua for HardlinkForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for HardlinkOpt { +impl IntoLua for HardlinkForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/hidden.rs b/yazi-parser/src/mgr/hidden.rs index c80e1e27..23c5429d 100644 --- a/yazi-parser/src/mgr/hidden.rs +++ b/yazi-parser/src/mgr/hidden.rs @@ -6,11 +6,11 @@ use yazi_binding::SER_OPT; use yazi_shared::event::ActionCow; #[derive(Debug, Default, Deserialize, Serialize)] -pub struct HiddenOpt { - pub state: HiddenOptState, +pub struct HiddenForm { + pub state: HiddenFormState, } -impl TryFrom for HiddenOpt { +impl TryFrom for HiddenForm { type Error = anyhow::Error; fn try_from(a: ActionCow) -> Result { @@ -18,18 +18,18 @@ impl TryFrom for HiddenOpt { } } -impl FromLua for HiddenOpt { +impl FromLua for HiddenForm { fn from_lua(value: Value, lua: &Lua) -> mlua::Result { lua.from_value(value) } } -impl IntoLua for HiddenOpt { +impl IntoLua for HiddenForm { fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value_with(&self, SER_OPT) } } // --- State #[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)] #[serde(rename_all = "kebab-case")] -pub enum HiddenOptState { +pub enum HiddenFormState { #[default] None, Show, @@ -37,7 +37,7 @@ pub enum HiddenOptState { Toggle, } -impl FromStr for HiddenOptState { +impl FromStr for HiddenFormState { type Err = serde::de::value::Error; fn from_str(s: &str) -> Result { @@ -45,7 +45,7 @@ impl FromStr for HiddenOptState { } } -impl HiddenOptState { +impl HiddenFormState { pub fn bool(self, old: bool) -> bool { match self { Self::None => old, diff --git a/yazi-parser/src/mgr/hover.rs b/yazi-parser/src/mgr/hover.rs index d4ab068d..cab56f6f 100644 --- a/yazi-parser/src/mgr/hover.rs +++ b/yazi-parser/src/mgr/hover.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::path::PathBufDyn; #[derive(Debug, Default)] -pub struct HoverOpt { +pub struct HoverForm { pub urn: Option, } -impl From> for HoverOpt { +impl From> for HoverForm { fn from(urn: Option) -> Self { Self { urn } } } -impl FromLua for HoverOpt { +impl FromLua for HoverForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for HoverOpt { +impl IntoLua for HoverForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/linemode.rs b/yazi-parser/src/mgr/linemode.rs index b710ae6f..fe9623d1 100644 --- a/yazi-parser/src/mgr/linemode.rs +++ b/yazi-parser/src/mgr/linemode.rs @@ -3,16 +3,16 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{SStr, event::ActionCow}; #[derive(Debug)] -pub struct LinemodeOpt { +pub struct LinemodeForm { pub new: SStr, } -impl TryFrom for LinemodeOpt { +impl TryFrom for LinemodeForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Ok(new) = a.take_first::() else { - bail!("a string argument is required for LinemodeOpt"); + bail!("a string argument is required for LinemodeForm"); }; if new.is_empty() || new.len() > 20 { @@ -23,10 +23,10 @@ impl TryFrom for LinemodeOpt { } } -impl FromLua for LinemodeOpt { +impl FromLua for LinemodeForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for LinemodeOpt { +impl IntoLua for LinemodeForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/link.rs b/yazi-parser/src/mgr/link.rs index d9970faa..e1c39f5c 100644 --- a/yazi-parser/src/mgr/link.rs +++ b/yazi-parser/src/mgr/link.rs @@ -2,19 +2,19 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct LinkOpt { +pub struct LinkForm { pub relative: bool, pub force: bool, } -impl From for LinkOpt { +impl From for LinkForm { fn from(a: ActionCow) -> Self { Self { relative: a.bool("relative"), force: a.bool("force") } } } -impl FromLua for LinkOpt { +impl FromLua for LinkForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for LinkOpt { +impl IntoLua for LinkForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/paste.rs b/yazi-parser/src/mgr/paste.rs index d9e7c42a..2eecc4fe 100644 --- a/yazi-parser/src/mgr/paste.rs +++ b/yazi-parser/src/mgr/paste.rs @@ -2,19 +2,19 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct PasteOpt { +pub struct PasteForm { pub force: bool, pub follow: bool, } -impl From for PasteOpt { +impl From for PasteForm { fn from(a: ActionCow) -> Self { Self { force: a.bool("force"), follow: a.bool("follow") } } } -impl FromLua for PasteOpt { +impl FromLua for PasteForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for PasteOpt { +impl IntoLua for PasteForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/peek.rs b/yazi-parser/src/mgr/peek.rs index 74143608..e5fdc348 100644 --- a/yazi-parser/src/mgr/peek.rs +++ b/yazi-parser/src/mgr/peek.rs @@ -2,14 +2,14 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlCow}; #[derive(Debug, Default)] -pub struct PeekOpt { +pub struct PeekForm { pub skip: Option, pub force: bool, pub only_if: Option>, pub upper_bound: bool, } -impl From for PeekOpt { +impl From for PeekForm { fn from(mut a: ActionCow) -> Self { Self { skip: a.first().ok(), @@ -20,14 +20,14 @@ impl From for PeekOpt { } } -impl From for PeekOpt { +impl From for PeekForm { fn from(force: bool) -> Self { Self { force, ..Default::default() } } } -impl FromLua for PeekOpt { +impl FromLua for PeekForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for PeekOpt { +impl IntoLua for PeekForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/remove.rs b/yazi-parser/src/mgr/remove.rs index 7225b349..cf41c029 100644 --- a/yazi-parser/src/mgr/remove.rs +++ b/yazi-parser/src/mgr/remove.rs @@ -2,14 +2,14 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlBuf}; #[derive(Debug)] -pub struct RemoveOpt { +pub struct RemoveForm { pub force: bool, pub permanently: bool, pub hovered: bool, pub targets: Vec, } -impl From for RemoveOpt { +impl From for RemoveForm { fn from(mut a: ActionCow) -> Self { Self { force: a.bool("force"), @@ -20,10 +20,10 @@ impl From for RemoveOpt { } } -impl FromLua for RemoveOpt { +impl FromLua for RemoveForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for RemoveOpt { +impl IntoLua for RemoveForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/rename.rs b/yazi-parser/src/mgr/rename.rs index 69b459b4..5ca00efe 100644 --- a/yazi-parser/src/mgr/rename.rs +++ b/yazi-parser/src/mgr/rename.rs @@ -2,14 +2,14 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{SStr, event::ActionCow}; #[derive(Debug)] -pub struct RenameOpt { +pub struct RenameForm { pub hovered: bool, pub force: bool, pub empty: SStr, pub cursor: SStr, } -impl From for RenameOpt { +impl From for RenameForm { fn from(mut a: ActionCow) -> Self { Self { hovered: a.bool("hovered"), @@ -20,10 +20,10 @@ impl From for RenameOpt { } } -impl FromLua for RenameOpt { +impl FromLua for RenameForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for RenameOpt { +impl IntoLua for RenameForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/reveal.rs b/yazi-parser/src/mgr/reveal.rs index 8d8daf8e..b19172c9 100644 --- a/yazi-parser/src/mgr/reveal.rs +++ b/yazi-parser/src/mgr/reveal.rs @@ -6,13 +6,13 @@ use yazi_vfs::provider; use crate::mgr::CdSource; #[derive(Debug)] -pub struct RevealOpt { +pub struct RevealForm { pub target: UrlBuf, pub source: CdSource, pub no_dummy: bool, } -impl From for RevealOpt { +impl From for RevealForm { fn from(mut a: ActionCow) -> Self { let mut target = a.take_first().unwrap_or_default(); @@ -30,18 +30,18 @@ impl From for RevealOpt { } } -impl From for RevealOpt { +impl From for RevealForm { fn from(target: UrlBuf) -> Self { Self { target, source: CdSource::Reveal, no_dummy: false } } } -impl From<(UrlBuf, CdSource)> for RevealOpt { +impl From<(UrlBuf, CdSource)> for RevealForm { fn from((target, source): (UrlBuf, CdSource)) -> Self { Self { target, source, no_dummy: false } } } -impl FromLua for RevealOpt { +impl FromLua for RevealForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for RevealOpt { +impl IntoLua for RevealForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/seek.rs b/yazi-parser/src/mgr/seek.rs index a646b24b..e9e49548 100644 --- a/yazi-parser/src/mgr/seek.rs +++ b/yazi-parser/src/mgr/seek.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct SeekOpt { +pub struct SeekForm { pub units: i16, } -impl From for SeekOpt { +impl From for SeekForm { fn from(a: ActionCow) -> Self { Self { units: a.first().unwrap_or(0) } } } -impl FromLua for SeekOpt { +impl FromLua for SeekForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for SeekOpt { +impl IntoLua for SeekForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/shell.rs b/yazi-parser/src/mgr/shell.rs index f5914b60..58253f89 100644 --- a/yazi-parser/src/mgr/shell.rs +++ b/yazi-parser/src/mgr/shell.rs @@ -3,7 +3,7 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{SStr, event::ActionCow, url::UrlCow}; #[derive(Debug)] -pub struct ShellOpt { +pub struct ShellForm { pub run: SStr, pub cwd: Option>, @@ -14,7 +14,7 @@ pub struct ShellOpt { pub cursor: Option, } -impl TryFrom for ShellOpt { +impl TryFrom for ShellForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { @@ -37,10 +37,10 @@ impl TryFrom for ShellOpt { } } -impl FromLua for ShellOpt { +impl FromLua for ShellForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ShellOpt { +impl IntoLua for ShellForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/sort.rs b/yazi-parser/src/mgr/sort.rs index fc689e3a..84e4a45d 100644 --- a/yazi-parser/src/mgr/sort.rs +++ b/yazi-parser/src/mgr/sort.rs @@ -5,7 +5,7 @@ use yazi_fs::{SortBy, SortFallback}; use yazi_shared::event::ActionCow; #[derive(Debug, Default, Deserialize, Serialize)] -pub struct SortOpt { +pub struct SortForm { pub by: Option, pub reverse: Option, pub dir_first: Option, @@ -14,7 +14,7 @@ pub struct SortOpt { pub fallback: Option, } -impl TryFrom for SortOpt { +impl TryFrom for SortForm { type Error = anyhow::Error; fn try_from(a: ActionCow) -> Result { @@ -29,10 +29,10 @@ impl TryFrom for SortOpt { } } -impl FromLua for SortOpt { +impl FromLua for SortForm { fn from_lua(value: Value, lua: &Lua) -> mlua::Result { lua.from_value(value) } } -impl IntoLua for SortOpt { +impl IntoLua for SortForm { fn into_lua(self, lua: &Lua) -> mlua::Result { lua.to_value_with(&self, SER_OPT) } } diff --git a/yazi-parser/src/mgr/stash.rs b/yazi-parser/src/mgr/stash.rs index 9dfa2bc3..cc20694f 100644 --- a/yazi-parser/src/mgr/stash.rs +++ b/yazi-parser/src/mgr/stash.rs @@ -4,25 +4,25 @@ use serde::{Deserialize, Serialize}; use yazi_binding::{SER_OPT, Url}; use yazi_shared::{event::ActionCow, url::UrlBuf}; -use crate::mgr::{CdOpt, CdSource}; +use crate::mgr::{CdForm, CdSource}; #[derive(Debug, Deserialize, Serialize)] -pub struct StashOpt { +pub struct StashForm { pub target: UrlBuf, pub source: CdSource, } -impl TryFrom for StashOpt { +impl TryFrom for StashForm { type Error = anyhow::Error; fn try_from(_: ActionCow) -> Result { bail!("unsupported") } } -impl From for StashOpt { - fn from(opt: CdOpt) -> Self { Self { target: opt.target, source: opt.source } } +impl From for StashForm { + fn from(opt: CdForm) -> Self { Self { target: opt.target, source: opt.source } } } -impl FromLua for StashOpt { +impl FromLua for StashForm { fn from_lua(value: Value, lua: &Lua) -> mlua::Result { let tbl = value.as_table().ok_or_else(|| "expected table".into_lua_err())?; Ok(Self { @@ -32,7 +32,7 @@ impl FromLua for StashOpt { } } -impl IntoLua for StashOpt { +impl IntoLua for StashForm { fn into_lua(self, lua: &Lua) -> mlua::Result { lua .create_table_from([ diff --git a/yazi-parser/src/mgr/tab_close.rs b/yazi-parser/src/mgr/tab_close.rs index e5205cbe..20e5e868 100644 --- a/yazi-parser/src/mgr/tab_close.rs +++ b/yazi-parser/src/mgr/tab_close.rs @@ -2,22 +2,22 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct TabCloseOpt { +pub struct TabCloseForm { pub idx: usize, } -impl From for TabCloseOpt { +impl From for TabCloseForm { fn from(a: ActionCow) -> Self { Self { idx: a.first().unwrap_or(0) } } } -impl From for TabCloseOpt { +impl From for TabCloseForm { fn from(idx: usize) -> Self { Self { idx } } } -impl FromLua for TabCloseOpt { +impl FromLua for TabCloseForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for TabCloseOpt { +impl IntoLua for TabCloseForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/tab_create.rs b/yazi-parser/src/mgr/tab_create.rs index f891d19f..0270af04 100644 --- a/yazi-parser/src/mgr/tab_create.rs +++ b/yazi-parser/src/mgr/tab_create.rs @@ -5,11 +5,11 @@ use yazi_shared::{event::ActionCow, url::UrlCow}; use yazi_vfs::provider; #[derive(Debug)] -pub struct TabCreateOpt { +pub struct TabCreateForm { pub url: Option>, } -impl From for TabCreateOpt { +impl From for TabCreateForm { fn from(mut a: ActionCow) -> Self { if a.bool("current") { return Self { url: None }; @@ -33,10 +33,10 @@ impl From for TabCreateOpt { } } -impl FromLua for TabCreateOpt { +impl FromLua for TabCreateForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for TabCreateOpt { +impl IntoLua for TabCreateForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/tab_rename.rs b/yazi-parser/src/mgr/tab_rename.rs index 45a0062b..cc6abb2e 100644 --- a/yazi-parser/src/mgr/tab_rename.rs +++ b/yazi-parser/src/mgr/tab_rename.rs @@ -3,12 +3,12 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{SStr, event::ActionCow}; #[derive(Debug)] -pub struct TabRenameOpt { +pub struct TabRenameForm { pub name: Option, pub interactive: bool, } -impl TryFrom for TabRenameOpt { +impl TryFrom for TabRenameForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { @@ -16,17 +16,17 @@ impl TryFrom for TabRenameOpt { let interactive = a.bool("interactive"); if name.is_none() && !interactive { - bail!("either name or interactive must be specified in TabRenameOpt"); + bail!("either name or interactive must be specified in TabRenameForm"); } Ok(Self { name, interactive }) } } -impl FromLua for TabRenameOpt { +impl FromLua for TabRenameForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for TabRenameOpt { +impl IntoLua for TabRenameForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/tab_switch.rs b/yazi-parser/src/mgr/tab_switch.rs index 69ad43ea..2075505e 100644 --- a/yazi-parser/src/mgr/tab_switch.rs +++ b/yazi-parser/src/mgr/tab_switch.rs @@ -2,21 +2,21 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct TabSwitchOpt { +pub struct TabSwitchForm { pub step: isize, pub relative: bool, } -impl From for TabSwitchOpt { +impl From for TabSwitchForm { fn from(a: ActionCow) -> Self { Self { step: a.first().unwrap_or(0), relative: a.bool("relative") } } } -impl FromLua for TabSwitchOpt { +impl FromLua for TabSwitchForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for TabSwitchOpt { +impl IntoLua for TabSwitchForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/toggle.rs b/yazi-parser/src/mgr/toggle.rs index 4ee8ac93..b333f506 100644 --- a/yazi-parser/src/mgr/toggle.rs +++ b/yazi-parser/src/mgr/toggle.rs @@ -2,12 +2,12 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlCow}; #[derive(Debug)] -pub struct ToggleOpt { +pub struct ToggleForm { pub url: Option>, pub state: Option, } -impl From for ToggleOpt { +impl From for ToggleForm { fn from(mut a: ActionCow) -> Self { Self { url: a.take_first().ok(), @@ -20,10 +20,10 @@ impl From for ToggleOpt { } } -impl FromLua for ToggleOpt { +impl FromLua for ToggleForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ToggleOpt { +impl IntoLua for ToggleForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/toggle_all.rs b/yazi-parser/src/mgr/toggle_all.rs index 70349587..a7d08d56 100644 --- a/yazi-parser/src/mgr/toggle_all.rs +++ b/yazi-parser/src/mgr/toggle_all.rs @@ -2,12 +2,12 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlCow}; #[derive(Debug)] -pub struct ToggleAllOpt { +pub struct ToggleAllForm { pub urls: Vec>, pub state: Option, } -impl From for ToggleAllOpt { +impl From for ToggleAllForm { fn from(mut a: ActionCow) -> Self { Self { urls: a.take_seq(), @@ -20,14 +20,14 @@ impl From for ToggleAllOpt { } } -impl From> for ToggleAllOpt { +impl From> for ToggleAllForm { fn from(state: Option) -> Self { Self { urls: vec![], state } } } -impl FromLua for ToggleAllOpt { +impl FromLua for ToggleAllForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ToggleAllOpt { +impl IntoLua for ToggleAllForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/update_files.rs b/yazi-parser/src/mgr/update_files.rs index 7ea73da2..6df7c7ab 100644 --- a/yazi-parser/src/mgr/update_files.rs +++ b/yazi-parser/src/mgr/update_files.rs @@ -4,30 +4,30 @@ use yazi_fs::FilesOp; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct UpdateFilesOpt { +pub struct UpdateFilesForm { pub op: FilesOp, } -impl TryFrom for UpdateFilesOpt { +impl TryFrom for UpdateFilesForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Some(op) = a.take_any("op") else { - bail!("Invalid 'op' in UpdateFilesOpt"); + bail!("Invalid 'op' in UpdateFilesForm"); }; Ok(Self { op }) } } -impl From for UpdateFilesOpt { +impl From for UpdateFilesForm { fn from(op: FilesOp) -> Self { Self { op } } } -impl FromLua for UpdateFilesOpt { +impl FromLua for UpdateFilesForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for UpdateFilesOpt { +impl IntoLua for UpdateFilesForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/update_mimes.rs b/yazi-parser/src/mgr/update_mimes.rs index f2e6f444..c5f1d433 100644 --- a/yazi-parser/src/mgr/update_mimes.rs +++ b/yazi-parser/src/mgr/update_mimes.rs @@ -4,26 +4,26 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{data::{Data, DataKey}, event::ActionCow}; #[derive(Debug)] -pub struct UpdateMimesOpt { +pub struct UpdateMimesForm { pub updates: HashMap, } -impl TryFrom for UpdateMimesOpt { +impl TryFrom for UpdateMimesForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Ok(updates) = a.take("updates") else { - bail!("Invalid 'updates' in UpdateMimesOpt"); + bail!("Invalid 'updates' in UpdateMimesForm"); }; Ok(Self { updates }) } } -impl FromLua for UpdateMimesOpt { +impl FromLua for UpdateMimesForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for UpdateMimesOpt { +impl IntoLua for UpdateMimesForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/update_paged.rs b/yazi-parser/src/mgr/update_paged.rs index cd94fc02..d375d5c7 100644 --- a/yazi-parser/src/mgr/update_paged.rs +++ b/yazi-parser/src/mgr/update_paged.rs @@ -2,25 +2,25 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlCow}; #[derive(Debug, Default)] -pub struct UpdatePagedOpt { +pub struct UpdatePagedForm { pub page: Option, pub only_if: Option>, } -impl From for UpdatePagedOpt { +impl From for UpdatePagedForm { fn from(mut a: ActionCow) -> Self { Self { page: a.first().ok(), only_if: a.take("only-if").ok() } } } -impl From<()> for UpdatePagedOpt { +impl From<()> for UpdatePagedForm { fn from(_: ()) -> Self { Self::default() } } -impl FromLua for UpdatePagedOpt { +impl FromLua for UpdatePagedForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for UpdatePagedOpt { +impl IntoLua for UpdatePagedForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/update_yanked.rs b/yazi-parser/src/mgr/update_yanked.rs index 0fe18475..23b13ac2 100644 --- a/yazi-parser/src/mgr/update_yanked.rs +++ b/yazi-parser/src/mgr/update_yanked.rs @@ -6,30 +6,30 @@ use serde::{Deserialize, Serialize}; use yazi_shared::event::ActionCow; #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct UpdateYankedOpt<'a>(pub yazi_dds::ember::EmberYank<'a>); +pub struct UpdateYankedForm<'a>(pub yazi_dds::ember::EmberYank<'a>); -impl<'a> Deref for UpdateYankedOpt<'a> { +impl<'a> Deref for UpdateYankedForm<'a> { type Target = yazi_dds::ember::EmberYank<'a>; fn deref(&self) -> &Self::Target { &self.0 } } -impl TryFrom for UpdateYankedOpt<'_> { +impl TryFrom for UpdateYankedForm<'_> { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Some(state) = a.take_any("state") else { - bail!("Invalid 'state' in UpdateYankedOpt"); + bail!("Invalid 'state' in UpdateYankedForm"); }; Ok(Self(state)) } } -impl FromLua for UpdateYankedOpt<'_> { +impl FromLua for UpdateYankedForm<'_> { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for UpdateYankedOpt<'_> { +impl IntoLua for UpdateYankedForm<'_> { fn into_lua(self, lua: &Lua) -> mlua::Result { self.0.into_lua(lua) } } diff --git a/yazi-parser/src/mgr/upload.rs b/yazi-parser/src/mgr/upload.rs index 33deb022..f3e1c5ad 100644 --- a/yazi-parser/src/mgr/upload.rs +++ b/yazi-parser/src/mgr/upload.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{event::ActionCow, url::UrlCow}; #[derive(Debug, Default)] -pub struct UploadOpt { +pub struct UploadForm { pub urls: Vec>, } -impl From for UploadOpt { +impl From for UploadForm { fn from(mut a: ActionCow) -> Self { Self { urls: a.take_seq() } } } -impl FromLua for UploadOpt { +impl FromLua for UploadForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for UploadOpt { +impl IntoLua for UploadForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/visual_mode.rs b/yazi-parser/src/mgr/visual_mode.rs index 38b7eb73..cbcc30dc 100644 --- a/yazi-parser/src/mgr/visual_mode.rs +++ b/yazi-parser/src/mgr/visual_mode.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct VisualModeOpt { +pub struct VisualModeForm { pub unset: bool, } -impl From for VisualModeOpt { +impl From for VisualModeForm { fn from(a: ActionCow) -> Self { Self { unset: a.bool("unset") } } } -impl FromLua for VisualModeOpt { +impl FromLua for VisualModeForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for VisualModeOpt { +impl IntoLua for VisualModeForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/mgr/yank.rs b/yazi-parser/src/mgr/yank.rs index 176c30c3..956d1025 100644 --- a/yazi-parser/src/mgr/yank.rs +++ b/yazi-parser/src/mgr/yank.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct YankOpt { +pub struct YankForm { pub cut: bool, } -impl From for YankOpt { +impl From for YankForm { fn from(a: ActionCow) -> Self { Self { cut: a.bool("cut") } } } -impl FromLua for YankOpt { +impl FromLua for YankForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for YankOpt { +impl IntoLua for YankForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/notify/tick.rs b/yazi-parser/src/notify/tick.rs index d8bd4ff7..e466c7d7 100644 --- a/yazi-parser/src/notify/tick.rs +++ b/yazi-parser/src/notify/tick.rs @@ -5,30 +5,30 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug, Default)] -pub struct TickOpt { +pub struct TickForm { pub interval: Duration, } -impl TryFrom for TickOpt { +impl TryFrom for TickForm { type Error = anyhow::Error; fn try_from(a: ActionCow) -> Result { let Ok(interval) = a.first() else { - bail!("Invalid 'interval' in TickOpt"); + bail!("Invalid 'interval' in TickForm"); }; if interval < 0.0 { - bail!("'interval' must be non-negative in TickOpt"); + bail!("'interval' must be non-negative in TickForm"); } Ok(Self { interval: Duration::from_secs_f64(interval) }) } } -impl FromLua for TickOpt { +impl FromLua for TickForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for TickOpt { +impl IntoLua for TickForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/pick/close.rs b/yazi-parser/src/pick/close.rs index 91a0d0b7..fc2065eb 100644 --- a/yazi-parser/src/pick/close.rs +++ b/yazi-parser/src/pick/close.rs @@ -2,22 +2,22 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Debug, Default)] -pub struct CloseOpt { +pub struct CloseForm { pub submit: bool, } -impl From for CloseOpt { +impl From for CloseForm { fn from(a: ActionCow) -> Self { Self { submit: a.bool("submit") } } } -impl From for CloseOpt { +impl From for CloseForm { fn from(submit: bool) -> Self { Self { submit } } } -impl FromLua for CloseOpt { +impl FromLua for CloseForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CloseOpt { +impl IntoLua for CloseForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/pick/show.rs b/yazi-parser/src/pick/show.rs index 0e9239f8..777853e3 100644 --- a/yazi-parser/src/pick/show.rs +++ b/yazi-parser/src/pick/show.rs @@ -5,31 +5,31 @@ use yazi_config::popup::PickCfg; use yazi_shared::event::ActionCow; #[derive(Debug)] -pub struct ShowOpt { +pub struct ShowForm { pub cfg: PickCfg, pub tx: mpsc::UnboundedSender>, } -impl TryFrom for ShowOpt { +impl TryFrom for ShowForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Some(cfg) = a.take_any("cfg") else { - bail!("Invalid 'cfg' in ShowOpt"); + bail!("Invalid 'cfg' in ShowForm"); }; let Some(tx) = a.take_any("tx") else { - bail!("Invalid 'tx' in ShowOpt"); + bail!("Invalid 'tx' in ShowForm"); }; Ok(Self { cfg, tx }) } } -impl FromLua for ShowOpt { +impl FromLua for ShowForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for ShowOpt { +impl IntoLua for ShowForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/spark/spark.rs b/yazi-parser/src/spark/spark.rs index cc7bf9f2..d951ecfb 100644 --- a/yazi-parser/src/spark/spark.rs +++ b/yazi-parser/src/spark/spark.rs @@ -5,119 +5,119 @@ use crate::{spark::SparkKind, try_from_spark}; #[derive(Debug)] pub enum Spark<'a> { // Void - Void(crate::VoidOpt), + Void(crate::VoidForm), // App AppAcceptPayload(yazi_dds::Payload<'a>), - AppBootstrap(crate::VoidOpt), - AppDeprecate(crate::app::DeprecateOpt), - AppFocus(crate::VoidOpt), - AppLua(crate::app::LuaOpt), - AppMouse(crate::app::MouseOpt), + AppBootstrap(crate::VoidForm), + AppDeprecate(crate::app::DeprecateForm), + AppFocus(crate::VoidForm), + AppLua(crate::app::LuaForm), + AppMouse(crate::app::MouseForm), AppPlugin(crate::app::PluginForm), AppPluginDo(crate::app::PluginForm), AppQuit(crate::app::QuitForm), - AppReflow(crate::app::ReflowOpt), - AppResize(crate::app::ReflowOpt), - AppResume(crate::app::ResumeOpt), - AppStop(crate::app::StopOpt), - AppTitle(crate::app::TitleOpt), - AppUpdateProgress(crate::app::UpdateProgressOpt), + AppReflow(crate::app::ReflowForm), + AppResize(crate::app::ReflowForm), + AppResume(crate::app::ResumeForm), + AppStop(crate::app::StopForm), + AppTitle(crate::app::TitleForm), + AppUpdateProgress(crate::app::UpdateProgressForm), // Mgr - Arrow(crate::ArrowOpt), - Back(crate::VoidOpt), - BulkExit(crate::mgr::BulkExitOpt), - BulkRename(crate::VoidOpt), - Cd(crate::mgr::CdOpt), + Arrow(crate::ArrowForm), + Back(crate::VoidForm), + BulkExit(crate::mgr::BulkExitForm), + BulkRename(crate::VoidForm), + Cd(crate::mgr::CdForm), Close(crate::mgr::CloseForm), - Copy(crate::mgr::CopyOpt), - Create(crate::mgr::CreateOpt), - Displace(crate::VoidOpt), + Copy(crate::mgr::CopyForm), + Create(crate::mgr::CreateForm), + Displace(crate::VoidForm), DisplaceDo(crate::mgr::DisplaceDoForm), - Download(crate::mgr::DownloadOpt), - Enter(crate::VoidOpt), - Escape(crate::mgr::EscapeOpt), - EscapeFilter(crate::VoidOpt), - EscapeFind(crate::VoidOpt), - EscapeSearch(crate::VoidOpt), - EscapeSelect(crate::VoidOpt), - EscapeVisual(crate::VoidOpt), + Download(crate::mgr::DownloadForm), + Enter(crate::VoidForm), + Escape(crate::mgr::EscapeForm), + EscapeFilter(crate::VoidForm), + EscapeFind(crate::VoidForm), + EscapeSearch(crate::VoidForm), + EscapeSelect(crate::VoidForm), + EscapeVisual(crate::VoidForm), Filter(crate::mgr::FilterForm), FilterDo(crate::mgr::FilterForm), - Find(crate::mgr::FindOpt), - FindArrow(crate::mgr::FindArrowOpt), + Find(crate::mgr::FindForm), + FindArrow(crate::mgr::FindArrowForm), FindDo(crate::mgr::FindDoForm), - Follow(crate::VoidOpt), - Forward(crate::VoidOpt), - Hardlink(crate::mgr::HardlinkOpt), - Hidden(crate::mgr::HiddenOpt), - Hover(crate::mgr::HoverOpt), - Leave(crate::VoidOpt), - Linemode(crate::mgr::LinemodeOpt), - Link(crate::mgr::LinkOpt), + Follow(crate::VoidForm), + Forward(crate::VoidForm), + Hardlink(crate::mgr::HardlinkForm), + Hidden(crate::mgr::HiddenForm), + Hover(crate::mgr::HoverForm), + Leave(crate::VoidForm), + Linemode(crate::mgr::LinemodeForm), + Link(crate::mgr::LinkForm), Open(crate::mgr::OpenForm), OpenDo(crate::mgr::OpenDoForm), - Paste(crate::mgr::PasteOpt), - Peek(crate::mgr::PeekOpt), + Paste(crate::mgr::PasteForm), + Peek(crate::mgr::PeekForm), Quit(crate::app::QuitForm), - Refresh(crate::VoidOpt), - Remove(crate::mgr::RemoveOpt), - RemoveDo(crate::mgr::RemoveOpt), - Rename(crate::mgr::RenameOpt), - Reveal(crate::mgr::RevealOpt), + Refresh(crate::VoidForm), + Remove(crate::mgr::RemoveForm), + RemoveDo(crate::mgr::RemoveForm), + Rename(crate::mgr::RenameForm), + Reveal(crate::mgr::RevealForm), Search(crate::mgr::SearchForm), SearchDo(crate::mgr::SearchForm), - SearchStop(crate::VoidOpt), - Seek(crate::mgr::SeekOpt), - Shell(crate::mgr::ShellOpt), - Sort(crate::mgr::SortOpt), + SearchStop(crate::VoidForm), + Seek(crate::mgr::SeekForm), + Shell(crate::mgr::ShellForm), + Sort(crate::mgr::SortForm), Spot(crate::mgr::SpotOpt), - Stash(crate::mgr::StashOpt), - Suspend(crate::VoidOpt), - TabClose(crate::mgr::TabCloseOpt), - TabCreate(crate::mgr::TabCreateOpt), - TabRename(crate::mgr::TabRenameOpt), - TabSwap(crate::ArrowOpt), - TabSwitch(crate::mgr::TabSwitchOpt), - Toggle(crate::mgr::ToggleOpt), - ToggleAll(crate::mgr::ToggleAllOpt), - Unyank(crate::VoidOpt), - UpdateFiles(crate::mgr::UpdateFilesOpt), - UpdateMimes(crate::mgr::UpdateMimesOpt), - UpdatePaged(crate::mgr::UpdatePagedOpt), + Stash(crate::mgr::StashForm), + Suspend(crate::VoidForm), + TabClose(crate::mgr::TabCloseForm), + TabCreate(crate::mgr::TabCreateForm), + TabRename(crate::mgr::TabRenameForm), + TabSwap(crate::ArrowForm), + TabSwitch(crate::mgr::TabSwitchForm), + Toggle(crate::mgr::ToggleForm), + ToggleAll(crate::mgr::ToggleAllForm), + Unyank(crate::VoidForm), + UpdateFiles(crate::mgr::UpdateFilesForm), + UpdateMimes(crate::mgr::UpdateMimesForm), + UpdatePaged(crate::mgr::UpdatePagedForm), UpdatePeeked(crate::mgr::UpdatePeekedForm), UpdateSpotted(crate::mgr::UpdateSpottedForm), - UpdateYanked(crate::mgr::UpdateYankedOpt<'a>), - Upload(crate::mgr::UploadOpt), - VisualMode(crate::mgr::VisualModeOpt), - Watch(crate::VoidOpt), - Yank(crate::mgr::YankOpt), + UpdateYanked(crate::mgr::UpdateYankedForm<'a>), + Upload(crate::mgr::UploadForm), + VisualMode(crate::mgr::VisualModeForm), + Watch(crate::VoidForm), + Yank(crate::mgr::YankForm), // Cmp - CmpArrow(crate::ArrowOpt), - CmpClose(crate::cmp::CloseOpt), + CmpArrow(crate::ArrowForm), + CmpClose(crate::cmp::CloseForm), CmpShow(crate::cmp::ShowForm), - CmpTrigger(crate::cmp::TriggerOpt), + CmpTrigger(crate::cmp::TriggerForm), // Confirm - ConfirmArrow(crate::ArrowOpt), - ConfirmClose(crate::confirm::CloseOpt), - ConfirmShow(Box), + ConfirmArrow(crate::ArrowForm), + ConfirmClose(crate::confirm::CloseForm), + ConfirmShow(Box), // Help - HelpArrow(crate::ArrowOpt), - HelpEscape(crate::VoidOpt), - HelpFilter(crate::VoidOpt), - HelpToggle(crate::help::ToggleOpt), + HelpArrow(crate::ArrowForm), + HelpEscape(crate::VoidForm), + HelpFilter(crate::VoidForm), + HelpToggle(crate::help::ToggleForm), // Input InputBackspace(yazi_widgets::input::parser::BackspaceOpt), InputBackward(yazi_widgets::input::parser::BackwardOpt), - InputClose(crate::input::CloseOpt), + InputClose(crate::input::CloseForm), InputComplete(yazi_widgets::input::parser::CompleteOpt), InputDelete(yazi_widgets::input::parser::DeleteOpt), - InputEscape(crate::VoidOpt), + InputEscape(crate::VoidForm), InputForward(yazi_widgets::input::parser::ForwardOpt), InputInsert(yazi_widgets::input::parser::InsertOpt), InputKill(yazi_widgets::input::parser::KillOpt), @@ -127,32 +127,32 @@ pub enum Spark<'a> { // Notify NotifyPush(crate::notify::PushForm), - NotifyTick(crate::notify::TickOpt), + NotifyTick(crate::notify::TickForm), // Pick - PickArrow(crate::ArrowOpt), - PickClose(crate::pick::CloseOpt), - PickShow(crate::pick::ShowOpt), + PickArrow(crate::ArrowForm), + PickClose(crate::pick::CloseForm), + PickShow(crate::pick::ShowForm), // Spot - SpotArrow(crate::ArrowOpt), - SpotClose(crate::VoidOpt), - SpotCopy(crate::spot::CopyOpt), - SpotSwipe(crate::ArrowOpt), + SpotArrow(crate::ArrowForm), + SpotClose(crate::VoidForm), + SpotCopy(crate::spot::CopyForm), + SpotSwipe(crate::ArrowForm), // Tasks - TasksArrow(crate::ArrowOpt), - TasksCancel(crate::VoidOpt), - TasksClose(crate::VoidOpt), - TasksInspect(crate::VoidOpt), + TasksArrow(crate::ArrowForm), + TasksCancel(crate::VoidForm), + TasksClose(crate::VoidForm), + TasksInspect(crate::VoidForm), TasksOpenShellCompat(crate::tasks::ProcessOpenForm), TasksProcessOpen(crate::tasks::ProcessOpenForm), - TasksShow(crate::VoidOpt), - TasksUpdateSucceed(crate::tasks::UpdateSucceedOpt), + TasksShow(crate::VoidForm), + TasksUpdateSucceed(crate::tasks::UpdateSucceedForm), // Which WhichActivate(crate::which::ActivateForm), - WhichDismiss(crate::VoidOpt), + WhichDismiss(crate::VoidForm), } impl<'a> Spark<'a> { @@ -341,7 +341,7 @@ impl<'a> IntoLua for Spark<'a> { } try_from_spark!( - crate::VoidOpt, + crate::VoidForm, app:bootstrap, app:focus, mgr:back, @@ -364,76 +364,76 @@ try_from_spark!( ); // App -try_from_spark!(crate::ArrowOpt, mgr:arrow, mgr:tab_swap); -try_from_spark!(crate::app::DeprecateOpt, app:deprecate); -try_from_spark!(crate::app::LuaOpt, app:lua); -try_from_spark!(crate::app::MouseOpt, app:mouse); +try_from_spark!(crate::ArrowForm, mgr:arrow, mgr:tab_swap); +try_from_spark!(crate::app::DeprecateForm, app:deprecate); +try_from_spark!(crate::app::LuaForm, app:lua); +try_from_spark!(crate::app::MouseForm, app:mouse); try_from_spark!(crate::app::PluginForm, app:plugin, app:plugin_do); try_from_spark!(crate::app::QuitForm, app:quit, mgr:quit); -try_from_spark!(crate::app::ReflowOpt, app:reflow, app:resize); -try_from_spark!(crate::app::ResumeOpt, app:resume); -try_from_spark!(crate::app::StopOpt, app:stop); -try_from_spark!(crate::app::TitleOpt, app:title); -try_from_spark!(crate::app::UpdateProgressOpt, app:update_progress); -try_from_spark!(crate::cmp::CloseOpt, cmp:close); +try_from_spark!(crate::app::ReflowForm, app:reflow, app:resize); +try_from_spark!(crate::app::ResumeForm, app:resume); +try_from_spark!(crate::app::StopForm, app:stop); +try_from_spark!(crate::app::TitleForm, app:title); +try_from_spark!(crate::app::UpdateProgressForm, app:update_progress); +try_from_spark!(crate::cmp::CloseForm, cmp:close); try_from_spark!(crate::cmp::ShowForm, cmp:show); -try_from_spark!(crate::cmp::TriggerOpt, cmp:trigger); -try_from_spark!(crate::confirm::CloseOpt, confirm:close); -try_from_spark!(crate::confirm::ShowOpt, confirm:show); -try_from_spark!(crate::help::ToggleOpt, help:toggle); -try_from_spark!(crate::input::CloseOpt, input:close); -try_from_spark!(crate::mgr::BulkExitOpt, mgr:bulk_exit); -try_from_spark!(crate::mgr::CdOpt, mgr:cd); +try_from_spark!(crate::cmp::TriggerForm, cmp:trigger); +try_from_spark!(crate::confirm::CloseForm, confirm:close); +try_from_spark!(crate::confirm::ShowForm, confirm:show); +try_from_spark!(crate::help::ToggleForm, help:toggle); +try_from_spark!(crate::input::CloseForm, input:close); +try_from_spark!(crate::mgr::BulkExitForm, mgr:bulk_exit); +try_from_spark!(crate::mgr::CdForm, mgr:cd); try_from_spark!(crate::mgr::CloseForm, mgr:close); -try_from_spark!(crate::mgr::CopyOpt, mgr:copy); -try_from_spark!(crate::mgr::CreateOpt, mgr:create); +try_from_spark!(crate::mgr::CopyForm, mgr:copy); +try_from_spark!(crate::mgr::CreateForm, mgr:create); try_from_spark!(crate::mgr::DisplaceDoForm, mgr:displace_do); -try_from_spark!(crate::mgr::DownloadOpt, mgr:download); -try_from_spark!(crate::mgr::EscapeOpt, mgr:escape); +try_from_spark!(crate::mgr::DownloadForm, mgr:download); +try_from_spark!(crate::mgr::EscapeForm, mgr:escape); try_from_spark!(crate::mgr::FilterForm, mgr:filter, mgr:filter_do); -try_from_spark!(crate::mgr::FindArrowOpt, mgr:find_arrow); +try_from_spark!(crate::mgr::FindArrowForm, mgr:find_arrow); try_from_spark!(crate::mgr::FindDoForm, mgr:find_do); -try_from_spark!(crate::mgr::FindOpt, mgr:find); -try_from_spark!(crate::mgr::HardlinkOpt, mgr:hardlink); -try_from_spark!(crate::mgr::HiddenOpt, mgr:hidden); -try_from_spark!(crate::mgr::HoverOpt, mgr:hover); -try_from_spark!(crate::mgr::LinemodeOpt, mgr:linemode); -try_from_spark!(crate::mgr::LinkOpt, mgr:link); +try_from_spark!(crate::mgr::FindForm, mgr:find); +try_from_spark!(crate::mgr::HardlinkForm, mgr:hardlink); +try_from_spark!(crate::mgr::HiddenForm, mgr:hidden); +try_from_spark!(crate::mgr::HoverForm, mgr:hover); +try_from_spark!(crate::mgr::LinemodeForm, mgr:linemode); +try_from_spark!(crate::mgr::LinkForm, mgr:link); try_from_spark!(crate::mgr::OpenDoForm, mgr:open_do); try_from_spark!(crate::mgr::OpenForm, mgr:open); -try_from_spark!(crate::mgr::PasteOpt, mgr:paste); -try_from_spark!(crate::mgr::PeekOpt, mgr:peek); -try_from_spark!(crate::mgr::RemoveOpt, mgr:remove, mgr:remove_do); -try_from_spark!(crate::mgr::RenameOpt, mgr:rename); -try_from_spark!(crate::mgr::RevealOpt, mgr:reveal); +try_from_spark!(crate::mgr::PasteForm, mgr:paste); +try_from_spark!(crate::mgr::PeekForm, mgr:peek); +try_from_spark!(crate::mgr::RemoveForm, mgr:remove, mgr:remove_do); +try_from_spark!(crate::mgr::RenameForm, mgr:rename); +try_from_spark!(crate::mgr::RevealForm, mgr:reveal); try_from_spark!(crate::mgr::SearchForm, mgr:search, mgr:search_do); -try_from_spark!(crate::mgr::SeekOpt, mgr:seek); -try_from_spark!(crate::mgr::ShellOpt, mgr:shell); -try_from_spark!(crate::mgr::SortOpt, mgr:sort); +try_from_spark!(crate::mgr::SeekForm, mgr:seek); +try_from_spark!(crate::mgr::ShellForm, mgr:shell); +try_from_spark!(crate::mgr::SortForm, mgr:sort); try_from_spark!(crate::mgr::SpotOpt, mgr:spot); -try_from_spark!(crate::mgr::StashOpt, mgr:stash); -try_from_spark!(crate::mgr::TabCloseOpt, mgr:tab_close); -try_from_spark!(crate::mgr::TabCreateOpt, mgr:tab_create); -try_from_spark!(crate::mgr::TabRenameOpt, mgr:tab_rename); -try_from_spark!(crate::mgr::TabSwitchOpt, mgr:tab_switch); -try_from_spark!(crate::mgr::ToggleAllOpt, mgr:toggle_all); -try_from_spark!(crate::mgr::ToggleOpt, mgr:toggle); -try_from_spark!(crate::mgr::UpdateFilesOpt, mgr:update_files); -try_from_spark!(crate::mgr::UpdateMimesOpt, mgr:update_mimes); -try_from_spark!(crate::mgr::UpdatePagedOpt, mgr:update_paged); +try_from_spark!(crate::mgr::StashForm, mgr:stash); +try_from_spark!(crate::mgr::TabCloseForm, mgr:tab_close); +try_from_spark!(crate::mgr::TabCreateForm, mgr:tab_create); +try_from_spark!(crate::mgr::TabRenameForm, mgr:tab_rename); +try_from_spark!(crate::mgr::TabSwitchForm, mgr:tab_switch); +try_from_spark!(crate::mgr::ToggleAllForm, mgr:toggle_all); +try_from_spark!(crate::mgr::ToggleForm, mgr:toggle); +try_from_spark!(crate::mgr::UpdateFilesForm, mgr:update_files); +try_from_spark!(crate::mgr::UpdateMimesForm, mgr:update_mimes); +try_from_spark!(crate::mgr::UpdatePagedForm, mgr:update_paged); try_from_spark!(crate::mgr::UpdatePeekedForm, mgr:update_peeked); try_from_spark!(crate::mgr::UpdateSpottedForm, mgr:update_spotted); -try_from_spark!(crate::mgr::UpdateYankedOpt<'a>, mgr:update_yanked); -try_from_spark!(crate::mgr::UploadOpt, mgr:upload); -try_from_spark!(crate::mgr::VisualModeOpt, mgr:visual_mode); -try_from_spark!(crate::mgr::YankOpt, mgr:yank); +try_from_spark!(crate::mgr::UpdateYankedForm<'a>, mgr:update_yanked); +try_from_spark!(crate::mgr::UploadForm, mgr:upload); +try_from_spark!(crate::mgr::VisualModeForm, mgr:visual_mode); +try_from_spark!(crate::mgr::YankForm, mgr:yank); try_from_spark!(crate::notify::PushForm, notify:push); -try_from_spark!(crate::notify::TickOpt, notify:tick); -try_from_spark!(crate::pick::CloseOpt, pick:close); -try_from_spark!(crate::pick::ShowOpt, pick:show); -try_from_spark!(crate::spot::CopyOpt, spot:copy); +try_from_spark!(crate::notify::TickForm, notify:tick); +try_from_spark!(crate::pick::CloseForm, pick:close); +try_from_spark!(crate::pick::ShowForm, pick:show); +try_from_spark!(crate::spot::CopyForm, spot:copy); try_from_spark!(crate::tasks::ProcessOpenForm, tasks:process_open); -try_from_spark!(crate::tasks::UpdateSucceedOpt, tasks:update_succeed); +try_from_spark!(crate::tasks::UpdateSucceedForm, tasks:update_succeed); try_from_spark!(crate::which::ActivateForm, which:activate); try_from_spark!(yazi_dds::Payload<'a>, app:accept_payload); try_from_spark!(yazi_widgets::input::InputOpt, input:show); diff --git a/yazi-parser/src/spot/copy.rs b/yazi-parser/src/spot/copy.rs index a073c50c..dd371a90 100644 --- a/yazi-parser/src/spot/copy.rs +++ b/yazi-parser/src/spot/copy.rs @@ -2,18 +2,18 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{SStr, event::ActionCow}; #[derive(Debug)] -pub struct CopyOpt { +pub struct CopyForm { pub r#type: SStr, } -impl From for CopyOpt { +impl From for CopyForm { fn from(mut a: ActionCow) -> Self { Self { r#type: a.take_first().unwrap_or_default() } } } -impl FromLua for CopyOpt { +impl FromLua for CopyForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for CopyOpt { +impl IntoLua for CopyForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/tasks/update_succeed.rs b/yazi-parser/src/tasks/update_succeed.rs index f7488e34..34211f79 100644 --- a/yazi-parser/src/tasks/update_succeed.rs +++ b/yazi-parser/src/tasks/update_succeed.rs @@ -3,28 +3,28 @@ use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::{Id, event::ActionCow, url::UrlBuf}; #[derive(Debug)] -pub struct UpdateSucceedOpt { +pub struct UpdateSucceedForm { pub id: Id, pub urls: Vec, pub track: bool, } -impl TryFrom for UpdateSucceedOpt { +impl TryFrom for UpdateSucceedForm { type Error = anyhow::Error; fn try_from(mut a: ActionCow) -> Result { let Some(urls) = a.take_any("urls") else { - bail!("Invalid 'urls' in UpdateSucceedOpt"); + bail!("Invalid 'urls' in UpdateSucceedForm"); }; Ok(Self { id: a.first()?, urls, track: a.get("track").unwrap_or_default() }) } } -impl FromLua for UpdateSucceedOpt { +impl FromLua for UpdateSucceedForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } -impl IntoLua for UpdateSucceedOpt { +impl IntoLua for UpdateSucceedForm { fn into_lua(self, _: &Lua) -> mlua::Result { Err("unsupported".into_lua_err()) } } diff --git a/yazi-parser/src/void.rs b/yazi-parser/src/void.rs index c82ac915..cc76c23a 100644 --- a/yazi-parser/src/void.rs +++ b/yazi-parser/src/void.rs @@ -2,20 +2,20 @@ use mlua::{FromLua, IntoLua, Lua, Value}; use yazi_shared::event::ActionCow; #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] -pub struct VoidOpt; +pub struct VoidForm; -impl From for VoidOpt { +impl From for VoidForm { fn from(_: ActionCow) -> Self { Self } } -impl From<()> for VoidOpt { +impl From<()> for VoidForm { fn from(_: ()) -> Self { Self } } -impl FromLua for VoidOpt { +impl FromLua for VoidForm { fn from_lua(_: Value, _: &Lua) -> mlua::Result { Ok(Self) } } -impl IntoLua for VoidOpt { +impl IntoLua for VoidForm { fn into_lua(self, lua: &Lua) -> mlua::Result { lua.create_table()?.into_lua(lua) } } diff --git a/yazi-plugin/Cargo.toml b/yazi-plugin/Cargo.toml index 292feb25..1953423b 100644 --- a/yazi-plugin/Cargo.toml +++ b/yazi-plugin/Cargo.toml @@ -52,6 +52,3 @@ unicode-width = { workspace = true } [target."cfg(unix)".dependencies] libc = { workspace = true } uzers = { workspace = true } - -[target."cfg(windows)".dependencies] -windows-sys = { version = "0.61.2", features = [ "Win32_System_JobObjects" ] } diff --git a/yazi-plugin/src/lib.rs b/yazi-plugin/src/lib.rs index 247e1ad4..6fefa534 100644 --- a/yazi-plugin/src/lib.rs +++ b/yazi-plugin/src/lib.rs @@ -1,4 +1,4 @@ -yazi_macro::mod_pub!(elements external fs process pubsub runtime theme utils); +yazi_macro::mod_pub!(elements external fs pubsub runtime theme utils); yazi_macro::mod_flat!(slim standard); diff --git a/yazi-plugin/src/slim.rs b/yazi-plugin/src/slim.rs index 4f909e01..e76608b1 100644 --- a/yazi-plugin/src/slim.rs +++ b/yazi-plugin/src/slim.rs @@ -16,7 +16,7 @@ pub fn slim_lua(lua: &Lua) -> mlua::Result<()> { yazi_binding::Path::install(&lua)?; yazi_binding::Error::install(&lua)?; - crate::process::install(&lua)?; + yazi_binding::process::install(&lua)?; yazi_runner::loader::install(&lua)?; // Addons diff --git a/yazi-plugin/src/standard.rs b/yazi-plugin/src/standard.rs index d6d5914c..c7a593c9 100644 --- a/yazi-plugin/src/standard.rs +++ b/yazi-plugin/src/standard.rs @@ -31,7 +31,7 @@ fn stage_1(lua: &Lua) -> Result<()> { yazi_binding::Error::install(lua)?; yazi_binding::Cha::install(lua)?; - crate::process::install(lua)?; + yazi_binding::process::install(lua)?; yazi_binding::File::install(lua)?; yazi_binding::Url::install(lua)?; yazi_binding::Path::install(lua)?; diff --git a/yazi-scheduler/src/lib.rs b/yazi-scheduler/src/lib.rs index 66ce8de2..77959f39 100644 --- a/yazi-scheduler/src/lib.rs +++ b/yazi-scheduler/src/lib.rs @@ -2,7 +2,7 @@ mod macros; yazi_macro::mod_pub!(fetch file hook plugin preload process size); -yazi_macro::mod_flat!(ongoing op out progress proxy runner scheduler snap summary task); +yazi_macro::mod_flat!(ongoing op out progress proxy scheduler snap summary task worker); const LOW: u8 = yazi_config::Priority::Low as u8; const NORMAL: u8 = yazi_config::Priority::Normal as u8; diff --git a/yazi-scheduler/src/process/mod.rs b/yazi-scheduler/src/process/mod.rs index 434c5dc5..6bbfc5f7 100644 --- a/yazi-scheduler/src/process/mod.rs +++ b/yazi-scheduler/src/process/mod.rs @@ -1,4 +1,4 @@ #[macro_use] mod macros; -yazi_macro::mod_flat!(opt out process progress r#in shell); +yazi_macro::mod_flat!(option out process progress r#in shell); diff --git a/yazi-scheduler/src/process/opt.rs b/yazi-scheduler/src/process/option.rs similarity index 87% rename from yazi-scheduler/src/process/opt.rs rename to yazi-scheduler/src/process/option.rs index f7949ca1..4171f02d 100644 --- a/yazi-scheduler/src/process/opt.rs +++ b/yazi-scheduler/src/process/option.rs @@ -2,7 +2,7 @@ use std::ffi::OsString; use yazi_shared::url::UrlCow; -// TODO: remove in favor of ShellOpt +// TODO: remove in favor of ShellForm #[derive(Clone, Debug)] pub struct ProcessOpt { pub cwd: UrlCow<'static>, diff --git a/yazi-scheduler/src/scheduler.rs b/yazi-scheduler/src/scheduler.rs index a6106d78..31065327 100644 --- a/yazi-scheduler/src/scheduler.rs +++ b/yazi-scheduler/src/scheduler.rs @@ -5,24 +5,24 @@ use yazi_config::{YAZI, plugin::{Fetcher, Preloader}}; use yazi_runner::plugin::PluginOpt; use yazi_shared::{CompletionToken, Id, Throttle, url::{UrlBuf, UrlLike}}; -use crate::{HIGH, LOW, NORMAL, Runner, Task, TaskProg, fetch::{FetchIn, FetchProg}, file::{FileInCopy, FileInCut, FileInDelete, FileInDownload, FileInHardlink, FileInLink, FileInTrash, FileInUpload, FileOutCopy, FileOutCut, FileOutDownload, FileOutHardlink, FileOutUpload, FileProgCopy, FileProgCut, FileProgDelete, FileProgDownload, FileProgHardlink, FileProgLink, FileProgTrash, FileProgUpload}, hook::{HookIn, HookInDelete, HookInDownload, HookInTrash, HookInUpload}, plugin::{PluginInEntry, PluginProgEntry}, preload::{PreloadIn, PreloadProg}, process::{ProcessInBg, ProcessInBlock, ProcessInOrphan, ProcessOpt, ProcessProgBg, ProcessProgBlock, ProcessProgOrphan}, size::{SizeIn, SizeProg}}; +use crate::{HIGH, LOW, NORMAL, Worker, Task, TaskProg, fetch::{FetchIn, FetchProg}, file::{FileInCopy, FileInCut, FileInDelete, FileInDownload, FileInHardlink, FileInLink, FileInTrash, FileInUpload, FileOutCopy, FileOutCut, FileOutDownload, FileOutHardlink, FileOutUpload, FileProgCopy, FileProgCut, FileProgDelete, FileProgDownload, FileProgHardlink, FileProgLink, FileProgTrash, FileProgUpload}, hook::{HookIn, HookInDelete, HookInDownload, HookInTrash, HookInUpload}, plugin::{PluginInEntry, PluginProgEntry}, preload::{PreloadIn, PreloadProg}, process::{ProcessInBg, ProcessInBlock, ProcessInOrphan, ProcessOpt, ProcessProgBg, ProcessProgBlock, ProcessProgOrphan}, size::{SizeIn, SizeProg}}; pub struct Scheduler { - pub runner: Runner, + pub worker: Worker, pub user_action: AtomicU64, handles: Vec>, } impl Deref for Scheduler { - type Target = Runner; + type Target = Worker; - fn deref(&self) -> &Self::Target { &self.runner } + fn deref(&self) -> &Self::Target { &self.worker } } impl Scheduler { pub fn serve() -> Self { - let (runner, handles) = Runner::make(); - Self { runner, user_action: AtomicU64::new(0), handles } + let (worker, handles) = Worker::make(); + Self { worker, user_action: AtomicU64::new(0), handles } } fn add(&self, name: String, map: impl FnOnce(&mut Task) -> R) -> R diff --git a/yazi-scheduler/src/runner.rs b/yazi-scheduler/src/worker.rs similarity index 99% rename from yazi-scheduler/src/runner.rs rename to yazi-scheduler/src/worker.rs index 03f9d9fe..7f9ba091 100644 --- a/yazi-scheduler/src/runner.rs +++ b/yazi-scheduler/src/worker.rs @@ -7,7 +7,7 @@ use yazi_config::YAZI; use crate::{LOW, Ongoing, TaskOp, TaskOps, TaskOut, fetch::{Fetch, FetchIn}, file::{File, FileIn}, hook::{Hook, HookIn}, plugin::{Plugin, PluginIn}, preload::{Preload, PreloadIn}, process::{Process, ProcessIn}, size::{Size, SizeIn}}; #[derive(Clone)] -pub struct Runner { +pub struct Worker { pub(super) file: Arc, pub(super) plugin: Arc, pub fetch: Arc, @@ -20,7 +20,7 @@ pub struct Runner { pub ongoing: Arc>, } -impl Runner { +impl Worker { pub(super) fn make() -> (Self, Vec>) { let (file_tx, file_rx) = async_priority_channel::unbounded(); let (plugin_tx, plugin_rx) = async_priority_channel::unbounded(); diff --git a/yazi-widgets/src/input/mod.rs b/yazi-widgets/src/input/mod.rs index 9938b24f..67838f22 100644 --- a/yazi-widgets/src/input/mod.rs +++ b/yazi-widgets/src/input/mod.rs @@ -1,3 +1,3 @@ yazi_macro::mod_pub!(actor parser); -yazi_macro::mod_flat!(event input mode op opt separator snap snaps widget); +yazi_macro::mod_flat!(event input mode op option separator snap snaps widget); diff --git a/yazi-widgets/src/input/opt.rs b/yazi-widgets/src/input/option.rs similarity index 100% rename from yazi-widgets/src/input/opt.rs rename to yazi-widgets/src/input/option.rs