refactor
This commit is contained in:
@@ -8,7 +8,7 @@ _ssh-proxy() {
|
||||
local -r cmdargs="start stop"
|
||||
local -r cnfargs="--help"
|
||||
local profiledir=~/.config/ssh-proxy
|
||||
#local tempdir="/tmp/ssh-proxy-${USER}"
|
||||
local tempdir="/tmp/ssh-proxy-${USER}"
|
||||
|
||||
if [[ ${COMP_WORDS[*]} == *"--help"* ]]; then
|
||||
return
|
||||
@@ -30,12 +30,18 @@ _ssh-proxy() {
|
||||
--help)
|
||||
return
|
||||
;;
|
||||
start | stop)
|
||||
start)
|
||||
local -r PROFILELIST=$(\ls ${profiledir})
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${PROFILELIST}" -- "${COMP_WORDS[COMP_CWORD]}"))
|
||||
return
|
||||
;;
|
||||
stop)
|
||||
local -r PROFILELIST=$(\ls ${tempdir})
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${PROFILELIST}" -- "${COMP_WORDS[COMP_CWORD]}"))
|
||||
return
|
||||
;;
|
||||
*)
|
||||
# shellcheck disable=SC2207
|
||||
COMPREPLY=($(compgen -W "${args}" -- "${COMP_WORDS[COMP_CWORD]}"))
|
||||
|
||||
Reference in New Issue
Block a user