ohmyzsh/plugins/sail/sail.plugin.zsh
2023-09-13 21:17:31 +02:00

30 lines
626 B
Bash

# Laravel Sail ZSH plugin
#
# Setting
: ${SAIL_ZSH_BIN_PATH:="./vendor/bin/sail"}
# Enable multiple commands with sail
function artisan \
composer \
node \
npm \
npx \
php \
yarn {
if checkForSail; then
$SAIL_ZSH_BIN_PATH "$0" "$@"
else
command "$0" "$@"
fi
}
# Check for the file in the current and parent directories.
checkForSail() {
# Check if ./vendor directory exists and if ./vendor/bin/sail file exists.
if [ -f $SAIL_ZSH_BIN_PATH ]; then
return 0
else
# Could not find $SAIL_ZSH_BIN_PATH in the current directory
return 1
fi
}