From d6e7058cb2657b0e33b3ab469b63e1274698b4c5 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Wed, 29 Jul 2020 13:29:33 +0200 Subject: [PATCH] zsh: add sudocker --- .zsh/40_function.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.zsh/40_function.zsh b/.zsh/40_function.zsh index fdd38f6..b472115 100755 --- a/.zsh/40_function.zsh +++ b/.zsh/40_function.zsh @@ -99,7 +99,7 @@ bbgrep () { } cgrep () { - find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) -print0 | xargs -0 grep --color -n "$@" + find . -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' -o -name "*.ino" \) -print0 | xargs -0 grep --color -n "$@" } hgrep () { @@ -215,6 +215,10 @@ apush() { adb root && adb wait-for-device && adb remount && adb wait-for-device && adb push $1 $2 } +sudocker(){ + DOCKER_EXEC_ARGS=${DOCKER_EXEC_ARGS:--u 0} + sdocker $@ +} sdocker (){ DOCKER_SSH_AUTH=$HOME/docker_ssh_auth @@ -247,7 +251,7 @@ sdocker (){ fi else echo "Attach to $img" - docker exec -it $img /bin/bash + eval docker exec ${DOCKER_EXEC_ARGS} -it $img /bin/bash fi }