9e23925b8581d22033f07f1983587412d3761494

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

fix(magic-enter): check for cmd existance before executing

Closes #13294

Diff

 1diff --git a/plugins/magic-enter/magic-enter.plugin.zsh b/plugins/magic-enter/magic-enter.plugin.zsh
 2index cfb15b60e82e8b95fc99b534c2d7694acc89f05d..722d747f3dc42b7f573afcd426ee92b58321ecaa 100644
 3--- a/plugins/magic-enter/magic-enter.plugin.zsh
 4+++ b/plugins/magic-enter/magic-enter.plugin.zsh
 5@@ -10,9 +10,10 @@ magic-enter() {
 6     return
 7   fi
 8 
 9-  if command jj st >/dev/null 2>&1; then # needs to be before git to handle colocated repositories
10+  # needs to be before git to handle colocated repositories
11+  if (( $+commands[jj] )) && command jj st >/dev/null 2>&1; then
12     BUFFER="$MAGIC_ENTER_JJ_COMMAND"
13-  elif command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
14+  elif (( $+commands[git] )) && command git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
15     BUFFER="$MAGIC_ENTER_GIT_COMMAND"
16   else
17     BUFFER="$MAGIC_ENTER_OTHER_COMMAND"