diff options
author | Luis Serra <74016165+serrovsky@users.noreply.github.com> | 2022-11-23 17:24:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 18:24:46 +0100 |
commit | a473c0cb4ad325de211f37388b0ff6ae435b6df4 (patch) | |
tree | e91e267caec3cae6fbbe8da6854c6479c80537dc | |
parent | 5485d70df2cefa9374c477425d2c1c84646a7d49 (diff) | |
download | zsh-a473c0cb4ad325de211f37388b0ff6ae435b6df4.tar.gz zsh-a473c0cb4ad325de211f37388b0ff6ae435b6df4.tar.bz2 zsh-a473c0cb4ad325de211f37388b0ff6ae435b6df4.zip |
feat(mongo-atlas): add completion for atlas (#11349)
-rw-r--r-- | plugins/mongo-atlas/README.md | 10 | ||||
-rw-r--r-- | plugins/mongo-atlas/mongo-atlas.plugin.zsh | 14 |
2 files changed, 24 insertions, 0 deletions
diff --git a/plugins/mongo-atlas/README.md b/plugins/mongo-atlas/README.md new file mode 100644 index 000000000..ef1b5e0d2 --- /dev/null +++ b/plugins/mongo-atlas/README.md @@ -0,0 +1,10 @@ +# MongoDB Atlas plugin + +This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for +MongoDB Atlas. + +To use it, add `mongo-atlas` to the plugins array in your zshrc file: + +```zsh +plugins=(... mongo-atlas) +``` 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" &| |