mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-24 23:00:09 +00:00
4cd5f7f920
Co-authored-by: Joshua Bedford <joshua.bedford@hurstreview.com> Co-authored-by: Marc Cornellà <marc.cornella@live.com>
40 lines
No EOL
1 KiB
Bash
40 lines
No EOL
1 KiB
Bash
# Settings
|
|
: ${LANDO_ZSH_SITES_DIRECTORY:="$HOME/Sites"}
|
|
: ${LANDO_ZSH_CONFIG_FILE:=.lando.yml}
|
|
|
|
# Enable multiple commands with lando.
|
|
function artisan \
|
|
composer \
|
|
drush \
|
|
gulp \
|
|
npm \
|
|
wp \
|
|
yarn {
|
|
if checkForLandoFile; then
|
|
lando "$0" "$@"
|
|
else
|
|
command "$0" "$@"
|
|
fi
|
|
}
|
|
|
|
# Check for the file in the current and parent directories.
|
|
checkForLandoFile() {
|
|
# Only bother checking for lando within the Sites directory.
|
|
if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then
|
|
# Not within $LANDO_ZSH_SITES_DIRECTORY
|
|
return 1
|
|
fi
|
|
|
|
local curr_dir="$PWD"
|
|
# Checking for file: $LANDO_ZSH_CONFIG_FILE within $LANDO_ZSH_SITES_DIRECTORY...
|
|
while [[ "$curr_dir" != "$LANDO_ZSH_SITES_DIRECTORY" ]]; do
|
|
if [[ -f "$curr_dir/$LANDO_ZSH_CONFIG_FILE" ]]; then
|
|
return 0
|
|
fi
|
|
curr_dir="${curr_dir:h}"
|
|
done
|
|
|
|
# Could not find $LANDO_ZSH_CONFIG_FILE in the current directory
|
|
# or in any of its parents up to $LANDO_ZSH_SITES_DIRECTORY.
|
|
return 1
|
|
} |