summaryrefslogtreecommitdiff
path: root/plugins/mongo-atlas/mongo-atlas.plugin.zsh
diff options
context:
space:
mode:
authorLuis Serra <74016165+serrovsky@users.noreply.github.com>2022-11-23 17:24:46 +0000
committerGitHub <noreply@github.com>2022-11-23 18:24:46 +0100
commita473c0cb4ad325de211f37388b0ff6ae435b6df4 (patch)
treee91e267caec3cae6fbbe8da6854c6479c80537dc /plugins/mongo-atlas/mongo-atlas.plugin.zsh
parent5485d70df2cefa9374c477425d2c1c84646a7d49 (diff)
downloadzsh-a473c0cb4ad325de211f37388b0ff6ae435b6df4.tar.gz
zsh-a473c0cb4ad325de211f37388b0ff6ae435b6df4.tar.bz2
zsh-a473c0cb4ad325de211f37388b0ff6ae435b6df4.zip
feat(mongo-atlas): add completion for atlas (#11349)
Diffstat (limited to 'plugins/mongo-atlas/mongo-atlas.plugin.zsh')
-rw-r--r--plugins/mongo-atlas/mongo-atlas.plugin.zsh14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mongo-atlas/mongo-atlas.plugin.zsh b/plugins/mongo-atlas/mongo-atlas.plugin.zsh
new file mode 100644
index 000000000..6762c909e
--- /dev/null
+++ b/plugins/mongo-atlas/mongo-atlas.plugin.zsh
@@ -0,0 +1,14 @@
+# Autocompletion for the Mongo Atlas CLI (atlas).
+if (( ! $+commands[atlas] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `atlas`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_atlas" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _atlas
+ _comps[atlas]=_atlas
+fi
+
+atlas completion zsh >| "$ZSH_CACHE_DIR/completions/atlas" &|