summaryrefslogtreecommitdiffstats
path: root/.config/zsh/oh-my-zsh/plugins/lando/lando.plugin.zsh
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2025-02-13 14:13:49 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2025-02-13 14:13:49 +0530
commit8a2e1006b3b272126332aa064f3ad95387129544 (patch)
tree944c80ac612a65980d94a54ba11b6c7102037ecf /.config/zsh/oh-my-zsh/plugins/lando/lando.plugin.zsh
parentdcbb16d8b08ff5956abef5e6478b59df2e93ad35 (diff)
downloaddotfiles-master.tar.gz
dotfiles-master.tar.bz2
dotfiles-master.zip
new dot filesHEADmaster
Diffstat (limited to '.config/zsh/oh-my-zsh/plugins/lando/lando.plugin.zsh')
-rw-r--r--.config/zsh/oh-my-zsh/plugins/lando/lando.plugin.zsh41
1 files changed, 41 insertions, 0 deletions
diff --git a/.config/zsh/oh-my-zsh/plugins/lando/lando.plugin.zsh b/.config/zsh/oh-my-zsh/plugins/lando/lando.plugin.zsh
new file mode 100644
index 0000000..af53e7e
--- /dev/null
+++ b/.config/zsh/oh-my-zsh/plugins/lando/lando.plugin.zsh
@@ -0,0 +1,41 @@
+# Settings
+: ${LANDO_ZSH_SITES_DIRECTORY:="$HOME/Sites"}
+: ${LANDO_ZSH_CONFIG_FILE:=.lando.yml}
+
+# Enable multiple commands with lando.
+function artisan \
+ composer \
+ drush \
+ gulp \
+ npm \
+ php \
+ 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
+} \ No newline at end of file