Skip to content

Commit

Permalink
Give better error message when codefresh is not installed (cloudposse…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru committed Aug 31, 2019
1 parent a7866c1 commit a9b355c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rootfs/usr/local/bin/codefresh-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ function green() {
echo "$(tput setaf 2)$*$(tput sgr0)" 1>&2
}

function _check_requirements() {
if ! which codefresh >/dev/null; then
red "! Missing required executable: codefresh"
red "! Codefresh can be installed with: apk add codefresh@cloudposse"
return 98
fi
}

# Keep us from exiting the shell if this file is sourced by using return instead of exit
function _main() {
case "$1" in
Expand All @@ -163,15 +171,15 @@ function _main() {
_usage
else
shift
download_pipelines "$@"
_check_requirements && download_pipelines "$@"
fi
;;
c | comp | compare)
if (($# != 2)); then
_usage
else
shift
compare_pipeline "$@"
_check_requirements && compare_pipeline "$@"
fi
;;
*)
Expand Down

0 comments on commit a9b355c

Please sign in to comment.