Browse Source

fix: make gimme a little more zsh friendly

Kyle P Davis 6 years ago
parent
commit
26f132d0a1
1 changed files with 7 additions and 3 deletions
  1. 7 3
      gimme

+ 7 - 3
gimme

@@ -26,7 +26,7 @@ has() {
 	if [[ "$FORCE" ]] && echo " $INIT_GIMMES " | grep -q " $1 "; then
 		false
 	else
-		which "$1" >/dev/null
+		command -v "$1" >/dev/null
 	fi
 }
 
@@ -72,9 +72,13 @@ gimme_pkg() {
 	fi
 }
 
-if [[ "$0" =~ [-]?bash ]]; then # sourced or piped
+if [[ "$ZSH_VERSION" ]]; then
+	setopt posixargzero
+fi
+
+if [[ "$0" =~ -?(z|ba)sh ]]; then # sourced or piped
 
-	if [[ "${BASH_SOURCE[@]}" ]]; then # sourced
+	if [[ "$ZSH_EVAL_CONTEXT" =~ :file$ || "${BASH_SOURCE[*]}" ]]; then # sourced
 
 		# if 'gimme' is not Add gimme to the PATH if not already found
 		if ! [[ "$PATH" == *"$GIMME_DIR"* ]]; then