refactor: consolidate shell escaping on shell_escape, drop shlex (#1065)

Both `shell_escape` and `shlex` were used for shell quoting. `shell_escape`
is the project standard (~10 files); `shlex` was only used in 2 call sites
for `try_quote()`. Consolidate on the single crate.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Maximilian Roos
2026-02-16 14:58:37 -08:00
committed by GitHub
co-authored by Claude
parent 600da7101b
commit 8ba5cd8002
5 changed files with 4 additions and 7 deletions
Generated
-1
View File
@@ -3219,7 +3219,6 @@ dependencies = [
"serde_json",
"shell-escape",
"shellexpand",
"shlex",
"signal-hook 0.4.3",
"similar",
"skim",
-1
View File
@@ -86,7 +86,6 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shell-escape = "0.1"
shellexpand = "3.1"
shlex = "1.3"
strum = { version = "0.27", features = ["derive"] }
synoptic = "2"
terminal_size = "0.4"
+1 -1
View File
@@ -261,7 +261,7 @@ pub fn handle_switch(
.collect();
let escaped_args: Vec<_> = expanded_args?
.iter()
.map(|arg| shlex::try_quote(arg).unwrap_or(arg.into()).into_owned())
.map(|arg| shell_escape::escape(arg.into()).into_owned())
.collect();
format!("{} {}", expanded_cmd, escaped_args.join(" "))
};
+1 -3
View File
@@ -138,9 +138,7 @@ pub fn handle_select(cli_branches: bool, cli_remotes: bool) -> anyhow::Result<()
// Get state path for key bindings (shell-escaped for safety)
let state_path_display = state.path.display().to_string();
let state_path_str = shlex::try_quote(&state_path_display)
.map(|s| s.into_owned())
.unwrap_or(state_path_display);
let state_path_str = shell_escape::escape(state_path_display.into()).into_owned();
// Calculate half-page scroll: skim uses 90% of terminal height, half of that = 45%
let half_page = terminal_size::terminal_size()
@@ -35,6 +35,7 @@ info:
WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
WORKTRUNK_TEST_EPOCH: "1735776000"
WORKTRUNK_TEST_NUSHELL_ENV: "0"
WORKTRUNK_TEST_POWERSHELL_ENV: "0"
WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
@@ -50,4 +51,4 @@ branch=args-test repo=repo
▲ Cannot change directory — shell integration not installed
↳ To enable automatic cd, run wt config shell install
◎ Executing (--execute) @ _REPO_.args-test:
  echo 'branch=args-test' 'repo=repo'
  echo branch=args-test repo=repo