Skip to content

Commit

Permalink
fetch-configlet: print success message
Browse files Browse the repository at this point in the history
Before this commit, `fetch-configlet` produced no output on success:

    $ bin/fetch-configlet
    $ echo $?
    0

With this commit, it prints a message while downloading, and then prints
the downloaded configlet version and its location:

    $ bin/fetch-configlet
    Fetching configlet...
    Downloaded configlet 4.0.0-beta.7 to ./bin/configlet

Closes: exercism/configlet#459
exercism/configlet#689
  • Loading branch information
ee7 authored and petertseng committed Nov 17, 2022
1 parent 9088a79 commit db945bd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/fetch-configlet
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ main() {
return 1
fi

echo "Fetching configlet..." >&2
download_url="$(get_download_url)"
output_path="${output_dir}/latest-configlet.${ext}"
curl "${curlopts[@]}" --output "${output_path}" "${download_url}"
Expand All @@ -69,6 +70,15 @@ main() {
esac

rm -f "${output_path}"

case "${os}" in
windows*) executable_ext='.exe' ;;
*) executable_ext='' ;;
esac

configlet_path="${output_dir}/configlet${executable_ext}"
configlet_version="$(${configlet_path} --version)"
echo "Downloaded configlet ${configlet_version} to ${configlet_path}"
}

main

0 comments on commit db945bd

Please sign in to comment.