fix: shell formatting for non-spread opener rules (#3532)

This commit is contained in:
三咲雅 misaki masa 2026-01-08 17:04:53 +08:00 committed by GitHub
parent 83674f19b4
commit ebedab3e29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 10 deletions

View file

@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
### Fixed
- Account for URL covariance in `Url:join()` ([#3514])
- Fix shell formatting for non-spread opener rules ([#3532])
## [v26.1.4]
@ -1593,3 +1594,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
[#3494]: https://github.com/sxyazi/yazi/pull/3494
[#3514]: https://github.com/sxyazi/yazi/pull/3514
[#3518]: https://github.com/sxyazi/yazi/pull/3518
[#3532]: https://github.com/sxyazi/yazi/pull/3532

View file

@ -1,7 +1,6 @@
use anyhow::Result;
use hashbrown::HashMap;
use yazi_config::{YAZI, popup::PickCfg};
use yazi_fs::Splatter;
use yazi_macro::succ;
use yazi_parser::{mgr::OpenDoOpt, tasks::ProcessOpenOpt};
use yazi_proxy::{PickProxy, TasksProxy};
@ -45,7 +44,7 @@ impl Actor for OpenDo {
if let Ok(choice) = pick.await {
TasksProxy::open_shell_compat(ProcessOpenOpt {
cwd: opt.cwd,
cmd: Splatter::new(&urls).splat(&openers[choice].run),
cmd: openers[choice].run.clone().into(),
args: urls,
block: openers[choice].block,
orphan: openers[choice].orphan,
@ -70,7 +69,7 @@ impl OpenDo {
for (opener, args) in openers {
cx.tasks.open_shell_compat(ProcessOpenOpt {
cwd: cwd.clone(),
cmd: Splatter::new(&args).splat(&opener.run),
cmd: opener.run.clone().into(),
args,
block: opener.block,
orphan: opener.orphan,

View file

@ -2,7 +2,6 @@ use std::borrow::Cow;
use anyhow::Result;
use yazi_config::popup::InputCfg;
use yazi_fs::Splatter;
use yazi_macro::{act, succ};
use yazi_parser::{mgr::ShellOpt, tasks::ProcessOpenOpt};
use yazi_proxy::{InputProxy, TasksProxy};
@ -40,7 +39,7 @@ impl Actor for Shell {
TasksProxy::open_shell_compat(ProcessOpenOpt {
cwd: cwd.into(),
cmd: Splatter::new(&selected).splat(&*opt.run),
cmd: opt.run.to_string().into(),
args: selected,
block: opt.block,
orphan: opt.orphan,

View file

@ -1,5 +1,6 @@
use std::mem;
use yazi_fs::Splatter;
use yazi_parser::tasks::ProcessOpenOpt;
use super::Tasks;
@ -8,6 +9,7 @@ impl Tasks {
// TODO: remove
pub fn open_shell_compat(&self, mut opt: ProcessOpenOpt) {
if opt.spread {
opt.cmd = Splatter::new(&opt.args).splat(opt.cmd);
self.scheduler.process_open(opt);
return;
}
@ -15,18 +17,20 @@ impl Tasks {
return;
}
if opt.args.len() == 2 {
opt.cmd = Splatter::new(&opt.args).splat(opt.cmd);
self.scheduler.process_open(opt);
return;
}
let hovered = mem::take(&mut opt.args[0]);
for target in opt.args.into_iter().skip(1) {
let args = vec![hovered.clone(), target];
self.scheduler.process_open(ProcessOpenOpt {
cwd: opt.cwd.clone(),
cmd: opt.cmd.clone(),
args: vec![hovered.clone(), target],
block: opt.block,
cwd: opt.cwd.clone(),
cmd: Splatter::new(&args).splat(&opt.cmd),
args,
block: opt.block,
orphan: opt.orphan,
done: None,
done: None,
spread: opt.spread,
});
}