Skip to content

Commit

Permalink
Merge pull request #1850 from tbhaxor/feature/completion/ngrok
Browse files Browse the repository at this point in the history
Added completion for ngrok tool
  • Loading branch information
Noah Gorny committed Apr 4, 2021
2 parents a6e2c2f + 0239ab8 commit ebe59c9
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ completion/available/kubectl.completion.bash
completion/available/lerna.completion.bash
completion/available/minikube.completion.bash
completion/available/notify-send.completion.bash
completion/available/ngrok.completion.bash
completion/available/npm.completion.bash
completion/available/packer.completion.bash
completion/available/pip.completion.bash
Expand Down
45 changes: 45 additions & 0 deletions completion/available/ngrok.completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# shellcheck shell=bash

__ngrok_completion() {
local prev=$(_get_pword)
local curr=$(_get_cword)

local BASE_NO_CONF="--log --log-format --log-level --help"
local BASE="--config $BASE_NO_CONF"
local DEFAULT="$BASE --authtoken --region"

case $prev in
authtoken)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$BASE" -- "$curr"))
;;
http)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --auth --bind-tls --host-header --hostname --inspect --subdomain" -- "$curr"))
;;
start)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --all --none" -- "$curr"))
;;
tcp)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --remote-addr" -- "$curr"))
;;
tls)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$DEFAULT --client-cas --crt --hostname --key --subdomain" -- "$curr"))
;;
update)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "$BASE_NO_CONF --channel" -- "$curr"))
;;
ngrok)
# shellcheck disable=SC2207
COMPREPLY=($(compgen -W "authtoken credits http start tcp tls update version help" -- "$curr"))
;;
*) ;;

esac
}

complete -F __ngrok_completion ngrok

0 comments on commit ebe59c9

Please sign in to comment.