Skip to content

Commit ebe59c9

Browse files
author
Noah Gorny
authored
Merge pull request #1850 from tbhaxor/feature/completion/ngrok
Added completion for ngrok tool
2 parents a6e2c2f + 0239ab8 commit ebe59c9

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

clean_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ completion/available/kubectl.completion.bash
8484
completion/available/lerna.completion.bash
8585
completion/available/minikube.completion.bash
8686
completion/available/notify-send.completion.bash
87+
completion/available/ngrok.completion.bash
8788
completion/available/npm.completion.bash
8889
completion/available/packer.completion.bash
8990
completion/available/pip.completion.bash
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# shellcheck shell=bash
2+
3+
__ngrok_completion() {
4+
local prev=$(_get_pword)
5+
local curr=$(_get_cword)
6+
7+
local BASE_NO_CONF="--log --log-format --log-level --help"
8+
local BASE="--config $BASE_NO_CONF"
9+
local DEFAULT="$BASE --authtoken --region"
10+
11+
case $prev in
12+
authtoken)
13+
# shellcheck disable=SC2207
14+
COMPREPLY=($(compgen -W "$BASE" -- "$curr"))
15+
;;
16+
http)
17+
# shellcheck disable=SC2207
18+
COMPREPLY=($(compgen -W "$DEFAULT --auth --bind-tls --host-header --hostname --inspect --subdomain" -- "$curr"))
19+
;;
20+
start)
21+
# shellcheck disable=SC2207
22+
COMPREPLY=($(compgen -W "$DEFAULT --all --none" -- "$curr"))
23+
;;
24+
tcp)
25+
# shellcheck disable=SC2207
26+
COMPREPLY=($(compgen -W "$DEFAULT --remote-addr" -- "$curr"))
27+
;;
28+
tls)
29+
# shellcheck disable=SC2207
30+
COMPREPLY=($(compgen -W "$DEFAULT --client-cas --crt --hostname --key --subdomain" -- "$curr"))
31+
;;
32+
update)
33+
# shellcheck disable=SC2207
34+
COMPREPLY=($(compgen -W "$BASE_NO_CONF --channel" -- "$curr"))
35+
;;
36+
ngrok)
37+
# shellcheck disable=SC2207
38+
COMPREPLY=($(compgen -W "authtoken credits http start tcp tls update version help" -- "$curr"))
39+
;;
40+
*) ;;
41+
42+
esac
43+
}
44+
45+
complete -F __ngrok_completion ngrok

0 commit comments

Comments
 (0)