exit on error, added support to detect if engine avaible
This commit is contained in:
parent
3f391f2392
commit
9fc61e0561
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
check_file() {
|
check_file() {
|
||||||
local file=""
|
file=""
|
||||||
local engine=""
|
engine=""
|
||||||
local opt
|
local opt
|
||||||
local OPTARG
|
local OPTARG
|
||||||
local OPTIND=1
|
local OPTIND=1
|
||||||
@ -54,11 +54,11 @@ check_file() {
|
|||||||
file="container-compose.yml"
|
file="container-compose.yml"
|
||||||
else
|
else
|
||||||
echo "no compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml, podman-compose.yml, podman-compose.yaml, container-compose.yaml or container-compose.yml file found, pass files with -f"
|
echo "no compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml, podman-compose.yml, podman-compose.yaml, container-compose.yaml or container-compose.yml file found, pass files with -f"
|
||||||
return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [ ! -f "$file" ]; then
|
elif [ ! -f "$file" ]; then
|
||||||
echo "File $file not found."
|
echo "File $file not found."
|
||||||
return 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set engine based on file if engine is not set
|
# Set engine based on file if engine is not set
|
||||||
@ -77,7 +77,17 @@ check_file() {
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Output the file and engine being used
|
if ! command -v "$engine" &> /dev/null
|
||||||
echo "Using $file with engine $engine"
|
then
|
||||||
|
echo "$engine Not found. Please install $engine or use a different engine. Specify with --engine=engine_name"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
check_file "$@"
|
check_file "$@"
|
||||||
|
|
||||||
|
|
||||||
|
# Output the file and engine being used
|
||||||
|
echo "Using $file with engine $engine"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user