ZSH: Linted files
This commit is contained in:
@ -1,14 +1,21 @@
|
||||
# Search for docker-compose files in the current and all sub direcotries and run docker compose with provided arguments
|
||||
|
||||
function dc() {
|
||||
if [ -z "$1" ]; then
|
||||
# display usage if no parameters given
|
||||
echo "Search for docker-compose files in the current and all sub direcotries and run docker compose with provided arguments"
|
||||
echo "Usage: dc <docker compose commands>"
|
||||
return 1
|
||||
else
|
||||
# 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' | sort); do
|
||||
cd $(dirname "$file")
|
||||
docker compose $@
|
||||
cd $(dirname "$file")
|
||||
docker compose $@
|
||||
done
|
||||
|
||||
# Change back to saved working directory
|
||||
cd ${CURRENT_DIR}
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user