File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -95,8 +95,8 @@ _kpf() {
9595 # set -x
9696
9797 usage () {
98- echo " Start/stop kubectl port-forward whilst running a command." >&2
99- echo " Usage: kfp TYPE/NAME [TEST_PORT:]REMOTE_PORT [...[TEST_PORT_N:]REMOTE_PORT_N] command [args..]" >&2
98+ echo " Start/stop kubectl port-forward whilst optionally running a command." >&2
99+ echo " Usage: kfp TYPE/NAME [TEST_PORT:]REMOTE_PORT [...[TEST_PORT_N:]REMOTE_PORT_N] [ command] [args..]" >&2
100100 echo " eg: kfp pod/my-pod 8080:80 curl http://localhost:8080" >&2
101101 exit 42
102102 }
@@ -129,9 +129,13 @@ _kpf() {
129129 done
130130 [[ " ${# ports[@]} " -eq 0 ]] && die " No port mappings specified"
131131
132- # parse command
133- [[ " $# " -eq 0 ]] && die " No command specified"
132+ # If no command, port-forward in foreground
133+ if [[ " $# " -eq 0 ]]; then
134+ echo " kubectl port-forward $resource ${ports[@]} " >&2
135+ exec kubectl port-forward " $resource " " ${ports[@]} "
136+ fi
134137
138+ # parse command
135139 kubectl port-forward " $resource " " ${ports[@]} " >&2 &
136140 kubectl_pid=$!
137141 echo kubectl port-forward " $resource " " ${ports[@]} " >&2
You can’t perform that action at this time.
0 commit comments