mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-15 01:48:34 -07:00
feat(lando): bypass lando
if command is not available in container (#11993)
Closes #11993
This commit is contained in:
parent
104041a018
commit
a8dee63ffe
@ -11,15 +11,23 @@ function artisan \
|
|||||||
php \
|
php \
|
||||||
wp \
|
wp \
|
||||||
yarn {
|
yarn {
|
||||||
if checkForLandoFile; then
|
# If the lando task is available in `lando --help`, then it means:
|
||||||
lando "$0" "$@"
|
#
|
||||||
|
# 1. `lando` is in a project with a `.lando.yml` file.
|
||||||
|
# 2. The lando task is available for lando, based on the .lando.yml config file.
|
||||||
|
#
|
||||||
|
# This has a penalty of about 250ms, so we still want to check if the lando file
|
||||||
|
# exists before, which is the fast path. If it exists, checking help output is
|
||||||
|
# still faster than running the command and failing.
|
||||||
|
if _lando_file_exists && lando --help 2>&1 | command grep -Eq "^ +lando $0 "; then
|
||||||
|
command lando "$0" "$@"
|
||||||
else
|
else
|
||||||
command "$0" "$@"
|
command "$0" "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for the file in the current and parent directories.
|
# Check for the file in the current and parent directories.
|
||||||
checkForLandoFile() {
|
_lando_file_exists() {
|
||||||
# Only bother checking for lando within the Sites directory.
|
# Only bother checking for lando within the Sites directory.
|
||||||
if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then
|
if [[ "$PWD/" != "$LANDO_ZSH_SITES_DIRECTORY"/* ]]; then
|
||||||
# Not within $LANDO_ZSH_SITES_DIRECTORY
|
# Not within $LANDO_ZSH_SITES_DIRECTORY
|
||||||
|
Loading…
Reference in New Issue
Block a user