1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 17:28:01 +00:00

Improve dexec function

This commit is contained in:
Daniel Carrillo 2020-05-01 16:12:36 +02:00
parent 2f5cd1cb23
commit c74c597f30

9
.zshrc
View File

@ -58,10 +58,15 @@ fzf-file-widget-hidden () {
dexec () {
local cid
local cmd=${1:-"bash"}
local cmd=("$@")
if [ -z "$1" ]; then
cmd=(bash)
fi
cid=$(docker ps -a | sed 1d | fzf -1 | awk '{print $1}')
[ -n "$cid" ] && docker exec -ti "$cid" $cmd
[ -n "$cid" ] && docker exec -ti "$cid" "${cmd[@]}"
}