diff --git a/src/cmd/cmd.rs b/src/cmd/cmd.rs index 184a5f21..9eb3dd95 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, } diff --git a/templates/bash.txt b/templates/bash.txt index a4177a89..ed4b422d 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 %}