From a88bb34387949f82be164763b95a909ee5c878f2 Mon Sep 17 00:00:00 2001 From: Sandro Date: Tue, 8 Apr 2025 15:13:35 +0200 Subject: [PATCH 1/2] Don't downcast PROMPT_COMMAND Since bash 5.0 PROMPT_COMMAND is an array. Lets not turn it into a string. Copied from https://github.com/direnv/direnv/blob/master/internal/cmd/shell_bash.go#L19-L23 --- templates/bash.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/templates/bash.txt b/templates/bash.txt index a4177a893..ed4b422db 100644 --- a/templates/bash.txt +++ b/templates/bash.txt @@ -55,7 +55,11 @@ function __zoxide_hook() { # Initialize hook. if [[ ${PROMPT_COMMAND:=} != *'__zoxide_hook'* ]]; then - PROMPT_COMMAND="__zoxide_hook;${PROMPT_COMMAND#;}" + if [[ "$(declare -p PROMPT_COMMAND 2>&1)" == "declare -a"* ]]; then + PROMPT_COMMAND=(__zoxide_hook "${PROMPT_COMMAND[@]}") + else + PROMPT_COMMAND="__zoxide_hook;${PROMPT_COMMAND#;}" + fi fi {%- endif %} From d28af07786c07686e4ece685a63568a254a8f496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 9 Apr 2025 14:16:28 +0200 Subject: [PATCH 2/2] Fix linting --- src/cmd/cmd.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/cmd.rs b/src/cmd/cmd.rs index 184a5f21e..9eb3dd95d 100644 --- a/src/cmd/cmd.rs +++ b/src/cmd/cmd.rs @@ -59,7 +59,8 @@ pub struct Add { #[clap(num_args = 1.., required = true, value_hint = ValueHint::DirPath)] pub paths: Vec, - /// The rank to increment the entry if it exists or initialize it with if it doesn't + /// The rank to increment the entry if it exists or initialize it with if it + /// doesn't #[clap(short, long)] pub score: Option, }