dotfiles/.config/zsh/autoload/dc

14 lines
462 B
Plaintext
Raw Normal View History

2024-10-28 15:03:39 +01:00
# Search for docker-compose files in the current and all sub direcotries and run docker compose with provided arguments
function dc() {
2024-10-28 15:03:39 +01:00
# Save current working directory
CURRENT_DIR="${PWD}"
for file in $(find ${PWD} -maxdepth 2 -type f -regextype posix-extended -regex '.*(docker-compose|compose)\.ya?ml'); do
cd $(dirname "$file")
docker compose $@
done
# Change back to saved working directory
cd ${CURRENT_DIR}
}