diff --git a/yazi-config/src/lib.rs b/yazi-config/src/lib.rs index 96b101da..0716dfb8 100644 --- a/yazi-config/src/lib.rs +++ b/yazi-config/src/lib.rs @@ -28,28 +28,6 @@ pub fn init() -> anyhow::Result<()> { try_init(false)?; } - // TODO: Remove in v0.3.2 - for c in &KEYMAP.manager { - for r in &c.run { - if r.name != "shell" { - continue; - } - if !r.bool("confirm") && !r.bool("interactive") { - let s = format!("`{}` ({})", c.on(), c.desc_or_run()); - eprintln!( - r#"WARNING: In Yazi v0.3, the behavior of the interactive `shell` (i.e., shell templates) must be explicitly specified with either `--interactive` or `--confirm`. - -Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` with `shell "my-template" --interactive`, in your keymap.toml for the key: {s}"# - ); - return Ok(()); - } else if r.bool("confirm") && r.bool("interactive") { - eprintln!( - "The `shell` command cannot specify both `--confirm` and `--interactive` at the same time.", - ); - } - } - } - // TODO: Remove in v0.3.6 if matches!(INPUT.create_title, popup::InputCreateTitle::One(_)) { eprintln!( diff --git a/yazi-core/src/tab/commands/shell.rs b/yazi-core/src/tab/commands/shell.rs index 5852da85..4a2a7723 100644 --- a/yazi-core/src/tab/commands/shell.rs +++ b/yazi-core/src/tab/commands/shell.rs @@ -11,7 +11,6 @@ pub struct Opt { run: Cow<'static, str>, block: bool, orphan: bool, - confirm: bool, interactive: bool, cursor: Option, } @@ -24,7 +23,6 @@ impl TryFrom for Opt { run: c.take_first_str().unwrap_or_default(), block: c.bool("block"), orphan: c.bool("orphan"), - confirm: c.bool("confirm"), interactive: c.bool("interactive"), cursor: c.get("cursor").and_then(Data::as_usize), }; @@ -48,26 +46,9 @@ impl Tab { Err(e) => return AppProxy::notify_warn("`shell` command", e), }; - // TODO: Remove in v0.3.2 - if !opt.interactive && !opt.confirm { - AppProxy::notify_error( - "`shell` command", - r#"WARNING: In Yazi v0.3, the behavior of the interactive `shell` (i.e., shell templates) must be explicitly specified with either `--interactive` or `--confirm`. - -Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` with `shell "my-template" --interactive`, in your keymap.toml"#, - ); - return; - } else if opt.interactive && opt.confirm { - AppProxy::notify_error( - "`shell` command", - "The `shell` command cannot specify both `--confirm` and `--interactive` at the same time.", - ); - return; - } - let selected = self.hovered_and_selected(true).cloned().collect(); tokio::spawn(async move { - if !opt.confirm || opt.run.is_empty() { + if opt.interactive { let mut result = InputProxy::show(InputCfg::shell(opt.block).with_value(opt.run).with_cursor(opt.cursor)); match result.recv().await { @@ -75,6 +56,9 @@ Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` wi _ => return, } } + if opt.run.is_empty() { + return; + } TasksProxy::open_with( selected, diff --git a/yazi-dds/src/sendable.rs b/yazi-dds/src/sendable.rs index e1948497..a08727a7 100644 --- a/yazi-dds/src/sendable.rs +++ b/yazi-dds/src/sendable.rs @@ -13,7 +13,13 @@ impl Sendable { Value::LightUserData(_) => Err("light userdata is not supported".into_lua_err())?, Value::Integer(i) => Data::Integer(i), Value::Number(n) => Data::Number(n), - Value::String(s) => Data::String(s.to_str()?.to_owned()), + Value::String(b) => { + if let Ok(s) = b.to_str() { + Data::String(s.to_owned()) + } else { + Data::Bytes(b.as_bytes().to_owned()) + } + } Value::Table(t) => { let (mut i, mut map) = (1, HashMap::with_capacity(t.raw_len())); for result in t.pairs::() { @@ -100,6 +106,7 @@ impl Sendable { Value::Table(tbl) } Data::Url(u) => Value::UserData(lua.create_any_userdata(u.clone())?), + Data::Bytes(b) => Value::String(lua.create_string(b)?), Data::Any(a) => { if let Some(t) = a.downcast_ref::() { Value::UserData(lua.create_userdata(t.clone())?) diff --git a/yazi-shared/src/event/data.rs b/yazi-shared/src/event/data.rs index d2e3ff2b..fac8cc4a 100644 --- a/yazi-shared/src/event/data.rs +++ b/yazi-shared/src/event/data.rs @@ -18,6 +18,8 @@ pub enum Data { #[serde(skip_deserializing)] Url(Url), #[serde(skip)] + Bytes(Vec), + #[serde(skip)] Any(Box), }