diff --git a/web/ssh-tunnelier b/web/ssh-tunnelier index 5495d8f..a8de86d 100755 --- a/web/ssh-tunnelier +++ b/web/ssh-tunnelier @@ -25,7 +25,11 @@ If run with arguments, runs an ssh tunnel with arguments: ssh-tunnelier hostname [local-port] remote-port If local port missing, the same port assumed in local - " + +Switches: + -h --help This help + -l List config entries +" exit 0 } @@ -193,9 +197,15 @@ function instant_entry() { printf "${colMenu}See the connection in 'list ssh'${colZ}\n" } -if [[ -n "$1" ]]; then - run_args "$@" - exit $? +for (( i=1; i<=$#; i++ )); do + [[ ${!i} = "-l" ]] && LISTONLY=1 +done + +if [[ "$LISTONLY" -ne 1 ]]; then + if [[ -n "$1" ]]; then + run_args "$@" + exit $? + fi fi while true; do @@ -208,6 +218,9 @@ while true; do printf "${colRow}ID PID host: ports\n" read_config printf "$colZ" + if [[ "$LISTONLY" -eq 1 ]]; then + break + fi read input [[ "$input" = "q" ]] && exit 0