diff options
| author | Carlo Sala <carlosalag@protonmail.com> | 2025-09-10 09:30:04 +0800 |
|---|---|---|
| committer | Carlo Sala <carlosalag@protonmail.com> | 2025-09-10 09:30:04 +0800 |
| commit | 9e23925b8581d22033f07f1983587412d3761494 (patch) | |
| tree | 8bf6b96facb425aedb4ec6b56e08a2a857c87351 | |
| parent | 8c168e26625ac8376d9156b1b189cd2ae8c16dc7 (diff) | |
| download | zsh-9e23925b8581d22033f07f1983587412d3761494.tar.gz zsh-9e23925b8581d22033f07f1983587412d3761494.tar.bz2 zsh-9e23925b8581d22033f07f1983587412d3761494.zip | |
fix(magic-enter): check for cmd existance before executing
Closes #13294
| -rw-r--r-- | plugins/magic-enter/magic-enter.plugin.zsh | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh index cfb15b60e..722d747f3 100644 --- a/plugins/magic-enter/magic-enter.plugin.zsh +++ b/plugins/magic-enter/magic-enter.plugin.zsh @@ -10,9 +10,10 @@ magic-enter() { return fi - if command jj st >/dev/null 2>&1; then # needs to be before git to handle colocated repositories + # needs to be before git to handle colocated repositories + if (( $+commands[jj] )) && command jj st >/dev/null 2>&1; then BUFFER="$MAGIC_ENTER_JJ_COMMAND" - elif command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + elif (( $+commands[git] )) && command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then BUFFER="$MAGIC_ENTER_GIT_COMMAND" else BUFFER="$MAGIC_ENTER_OTHER_COMMAND" |
