From 71cd8ff86aa4dd50210ba4d86a9ff5dc6339e9a0 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Fri, 4 Mar 2022 15:55:57 -0800 Subject: [PATCH] Update compose-check to suport compose subcommand --- compose-check.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compose-check.sh b/compose-check.sh index 7db83df..76fce2d 100755 --- a/compose-check.sh +++ b/compose-check.sh @@ -1,10 +1,19 @@ -#! /bin/bash +#! /usr/bin/env bash # Verifies that files passed in are valid for docker-compose set -e +if command -v docker-compose &> /dev/null ; then + COMPOSE=docker-compose +elif command -v docker &> /dev/null && docker help compose &> /dev/null; then + COMPOSE=docker compose +else + echo "ERROR: Neither 'docker-compose' or 'docker compose' were found" + exit 1 +fi + check_file() { local file=$1 - docker-compose --file "$file" config --quiet 2>&1 \ + env $COMPOSE --file "$file" config --quiet 2>&1 \ | sed "/variable is not set. Defaulting/d" return "${PIPESTATUS[0]}" }