diff --git a/CHANGELOG.md b/CHANGELOG.md index de26d01a..14ac0133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release - Replace raw echo with output helpers in general/update-dotnet-tools - Replace raw echo with output helpers in general/stream - Replace raw echo with output helpers in general/ssh-key-mgr +- Replace raw echo with output helpers in general/install-latest-dotnet ### Changed - Replace raw echo with standard output helpers (die/info/success) in github/cancel-workflows - Replace raw echo with standard output helpers (die/info/success) in git/update-repos-personal diff --git a/general/install-latest-dotnet b/general/install-latest-dotnet index ce42aba6..9d63f05d 100755 --- a/general/install-latest-dotnet +++ b/general/install-latest-dotnet @@ -1,11 +1,30 @@ #! /bin/bash die() { - echo - echo "$@" + if [ -t 2 ]; then + printf '\n\033[31m✗\033[0m %s\n' "$*" >&2 + else + printf '\n✗ %s\n' "$*" >&2 + fi exit 1 } +success() { + if [ -t 1 ]; then + printf '\n\033[32m✓\033[0m %s\n' "$*" + else + printf '\n✓ %s\n' "$*" + fi +} + +info() { + if [ -t 1 ]; then + printf '\n\033[32m→\033[0m %s\n' "$*" + else + printf '\n→ %s\n' "$*" + fi +} + # args: @@ -131,22 +150,19 @@ remove_beginning_slash() { } say() { - echo "dotnet-install: $1" + info "dotnet-install: $*" } say_verbose() { if [ "$verbose" = true ]; then - say "$1" + say "$*" fi } say_err() { - say "$1" - exit 1 + die "$*" } -#!/bin/bash - set -e get_latest_dotnet_sdk_version() { @@ -205,11 +221,8 @@ for VERSION in $VERSIONS_TO_INSTALL; do TEMPORARY_FILE="$(mktemp "$temporary_file_template")" - echo "**********************************************************************************************" - echo "* Installing dotnet: $VERSION" - echo "* Current SDK: $SDK_VERSION" - echo "**********************************************************************************************" - echo "" + info "Installing dotnet $VERSION (SDK: $SDK_VERSION)" + DOWNLOAD_URL=$DOWNLOAD_SOURCE/dotnet/Sdk/$SDK_VERSION/dotnet-sdk-$SDK_VERSION-linux-x64.tar.gz curl \ --max-time 120 \ @@ -227,14 +240,12 @@ for VERSION in $VERSIONS_TO_INSTALL; do /usr/share/dotnet/dotnet --list-sdks - echo "" done -echo "Install/update powershell" +info "Install/update powershell" /usr/share/dotnet/dotnet tool update --local PowerShell || dotnet tool install --local PowerShell -echo "Restoring tools" +info "Restoring tools" /usr/share/dotnet/dotnet tool restore - -echo "Done" +success "Done"