feat: adds the Laravel Sail plugin

This commit is contained in:
Marc-André Appel 2023-09-13 21:17:31 +02:00 committed by GitHub
commit 65419fa13c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,30 @@
# 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
}