Skip to content

Commit 69a6359

Browse files
authored
feat(ngrok): add completion plugin (ohmyzsh#12826)
1 parent 366d254 commit 69a6359

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

plugins/ngrok/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ngrok plugin
2+
3+
This plugin adds completion for the [ngrok](https://ngrok.com) CLI.
4+
5+
To use it, add `ngrok` to the plugins array in your zshrc file:
6+
7+
```zsh
8+
plugins=(... ngrok)
9+
```
10+
11+
This plugin does not add any aliases.
12+
13+
## Cache
14+
15+
This plugin caches the completion script and is automatically updated asynchronously when the plugin is
16+
loaded, which is usually when you start up a new terminal emulator.
17+
18+
The cache is stored at:
19+
20+
- `$ZSH_CACHE/completions/_ngrok` completions script

plugins/ngrok/ngrok.plugin.zsh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Autocompletion for ngrok
2+
if (( ! $+commands[ngrok] )); then
3+
return
4+
fi
5+
6+
# If the completion file doesn't exist yet, we need to autoload it and
7+
# bind it to `ngrok`. Otherwise, compinit will have already done that.
8+
if [[ ! -f "$ZSH_CACHE_DIR/completions/_ngrok" ]]; then
9+
typeset -g -A _comps
10+
autoload -Uz _ngrok
11+
_comps[ngrok]=_ngrok
12+
fi
13+
14+
ngrok completion zsh >| "$ZSH_CACHE_DIR/completions/_ngrok" &|

0 commit comments

Comments
 (0)