summaryrefslogtreecommitdiff
path: root/plugins/kamal/kamal.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/kamal/kamal.plugin.zsh')
-rw-r--r--plugins/kamal/kamal.plugin.zsh25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/kamal/kamal.plugin.zsh b/plugins/kamal/kamal.plugin.zsh
new file mode 100644
index 000000000..e21ab4f92
--- /dev/null
+++ b/plugins/kamal/kamal.plugin.zsh
@@ -0,0 +1,25 @@
+# Find kamal binary (local ./bin/kamal or global)
+function _kamal_command () {
+ if [ -x "./bin/kamal" ]; then
+ ./bin/kamal "$@"
+ else
+ command kamal "$@"
+ fi
+}
+
+function which-kamal() {
+ if [ -x "./bin/kamal" ]; then
+ echo "Using local ./bin/kamal"
+ else
+ echo "Using global $(command -v kamal)"
+ fi
+}
+
+# Use `_kamal_command`` function for `kamal` command
+alias kamal='_kamal_command'
+
+# Aliases
+alias kad='kamal deploy'
+
+# Hook up completion
+compdef _kamal_command=kamal