From 14930357027606d02df28be8500899c90b04dec7 Mon Sep 17 00:00:00 2001 From: Daniel-I-Am Date: Wed, 11 May 2022 21:55:53 +0200 Subject: [PATCH] Fix issue with shell closing on failed docker-env call --- templates/zshrc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/templates/zshrc b/templates/zshrc index 48901fc..6ff99c2 100644 --- a/templates/zshrc +++ b/templates/zshrc @@ -162,17 +162,6 @@ function see() { } function docker-env() { - function usage() { - cat >&2 < Publish a container's port(s) to the host - -v Bind mount a volume -EOS - exit 1 - } - port= workdir=/work_dir volumes=("$(pwd):/work_dir") @@ -185,13 +174,17 @@ EOS break ;; -p) - port=$2 + port="$2" shift ;; -v) volumes+=("$2") shift ;; + -w) + workdir="$2" + shift + ;; *) break ;; @@ -199,14 +192,21 @@ EOS if [ $# -eq 0 ] then - usage + break fi shift done if [ $# -eq 0 ] then - usage + cat >&2 < Publish a container's port(s) to the host + -v Bind mount a volume +EOS + return 1 fi image="$1" @@ -228,7 +228,7 @@ EOS run_command+=" -v $volume" done - run_command+=" $image $cmd" + run_command+=" -w \"$workdir\" $image $cmd" eval $run_command }