a473c0cb4ad325de211f37388b0ff6ae435b6df4

Author
Luis Serra <74016165+serrovsky@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(mongo-atlas): add completion for atlas (#11349)

Diff

 1diff --git a/plugins/mongo-atlas/README.md b/plugins/mongo-atlas/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..ef1b5e0d237d8326531a2eb48b68bb38d10318c4
 4--- /dev/null
 5+++ b/plugins/mongo-atlas/README.md
 6@@ -0,0 +1,10 @@
 7+# MongoDB Atlas plugin
 8+
 9+This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for 
10+MongoDB Atlas.
11+
12+To use it, add `mongo-atlas` to the plugins array in your zshrc file:
13+
14+```zsh
15+plugins=(... mongo-atlas)
16+```
17diff --git a/plugins/mongo-atlas/mongo-atlas.plugin.zsh b/plugins/mongo-atlas/mongo-atlas.plugin.zsh
18new file mode 100644
19index 0000000000000000000000000000000000000000..6762c909e1bb27cd2512fa1ef44af81d11596692
20--- /dev/null
21+++ b/plugins/mongo-atlas/mongo-atlas.plugin.zsh
22@@ -0,0 +1,14 @@
23+# Autocompletion for the Mongo Atlas CLI (atlas).
24+if (( ! $+commands[atlas] )); then
25+  return
26+fi
27+
28+# If the completion file doesn't exist yet, we need to autoload it and
29+# bind it to `atlas`. Otherwise, compinit will have already done that.
30+if [[ ! -f "$ZSH_CACHE_DIR/completions/_atlas" ]]; then
31+  typeset -g -A _comps
32+  autoload -Uz _atlas
33+  _comps[atlas]=_atlas
34+fi
35+
36+atlas completion zsh >| "$ZSH_CACHE_DIR/completions/atlas" &|