From 2dcb6bdcf7a797cc2eeb93b4b02293cab067be5b Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Tue, 12 Jul 2022 14:27:20 +0200 Subject: [PATCH] zsh: sdocker more verbose --- .zsh/40_function.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.zsh/40_function.zsh b/.zsh/40_function.zsh index 40c74be..5346669 100755 --- a/.zsh/40_function.zsh +++ b/.zsh/40_function.zsh @@ -285,16 +285,18 @@ sdocker (){ AOSP_ARGS=${AOSP_ARGS:--it} img=$(docker ps | grep $1 | awk '{print $1}'); if [ -z $img ]; then - img=$(docker ps -a | grep -w $1 | awk '{print $1}' | head -1); + details=$(docker ps -a | grep -w $1 | head -1); + img=$(echo ${details} | awk '{print $1}') + img_name=$(echo ${details} | awk '{print $2}') if [ -z $img ]; then - echo "Running a new container" + echo "Running a new container with image $img_name" docker run ${AOSP_ARGS} ${=SSH_AUTH_ARGS} -h $(hostname) -e DISPLAY=${DISPLAY} --privileged -v /dev/bus/usb:/dev/bus/usb -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v ${AOSP_IMAGE}:/aosp/Project -v $HOME/Sources/:/aosp/Sources/ -v /local/:/local/ --user="$(id -u):$(id -g)" $1 else - echo "Starting $img" + echo "Starting $img|$img_name" docker start -i -a $img fi else - echo "Attach to $img" + echo "Attach to $img|$img_name" eval docker exec ${DOCKER_EXEC_ARGS} -it $img /bin/bash fi }