From e6441cbbd7715ad914d437ebbf7df71286e6fd19 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 25 May 2026 23:27:12 +0200 Subject: lf/commands/base.sh: Correctly escape single quotes for lf commands --- modules/by-name/lf/lf/commands/base.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/by-name/lf/lf/commands/base.sh b/modules/by-name/lf/lf/commands/base.sh index 7003d76c..0c2f391a 100755 --- a/modules/by-name/lf/lf/commands/base.sh +++ b/modules/by-name/lf/lf/commands/base.sh @@ -50,7 +50,6 @@ trap 'rm --recursive "$__base_tmp_temporary_directory"' EXIT # Run a lf command on the current lf client # All arguments will run in like they were typed directly into lf. -# # TODO(@bpeetz): Escape the single quotes in the input arguments. <2025-02-02> # # # Type # lf_cmd :: [String] @@ -61,6 +60,8 @@ trap 'rm --recursive "$__base_tmp_temporary_directory"' EXIT lf_cmd() { arguments="" for arg in "$@"; do + arg="$(echo "$arg" | sed "s/'/\\\'/g")" + if [ -z "$arguments" ]; then arguments="'$arg'" else -- cgit 1.4.1