Skip to content

Commit 08fd616

Browse files
authored
Merge pull request #887 from rgoldberg/886-script-header-arrow-blue
Color script start header arrow blue iff tty
2 parents 486e8f3 + da620a9 commit 08fd616

10 files changed

Lines changed: 21 additions & 9 deletions

File tree

Scripts/_setup_script

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,13 @@ if ! cd -- "${mas_dir}"; then
4040
printf $'Error: Failed to cd into mas directory: %s\n' "${mas_dir}" >&2
4141
exit 1
4242
fi
43+
44+
print_header() {
45+
if [[ -t 1 ]]; then
46+
printf $'\e[1;34m==>\e[0m'
47+
else
48+
printf $'==>'
49+
fi
50+
printf $' %s' "${@}"
51+
printf $'\n'
52+
}

Scripts/bootstrap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
. "${0:a:h}/_setup_script"
1212

13-
printf $'==> 👢 Bootstrapping mas %s\n' "$(Scripts/version)"
13+
print_header '👢 Bootstrapping mas' "$(Scripts/version)"
1414

1515
if ! whence brew >/dev/null; then
1616
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
. "${0:a:h}/_setup_script"
1010

11-
printf $'==> 🏗​ Building mas %s\n' "$(Scripts/version)"
11+
print_header '🏗​ Building mas' "$(Scripts/version)"
1212

1313
Scripts/generate_package_swift "${1:-}"
1414

Scripts/clean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
. "${0:a:h}/_setup_script"
1010

11-
printf $'==> 🗑​ Cleaning mas %s\n' "$(Scripts/version)"
11+
print_header '🗑​ Cleaning mas' "$(Scripts/version)"
1212

1313
swift package clean
1414
swift package reset

Scripts/format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
. "${0:a:h}/_setup_script"
1212

13-
printf $'==> 🧹 Formatting mas %s\n' "$(Scripts/version)"
13+
print_header '🧹 Formatting mas' "$(Scripts/version)"
1414

1515
for formatter in markdownlint-cli2 swiftformat swiftlint yamllint; do
1616
if ! whence "${formatter}" >/dev/null; then

Scripts/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
. "${0:a:h}/_setup_script"
1414

15-
printf $'==> 🚨 Linting mas %s\n' "$(Scripts/version)"
15+
print_header '🚨 Linting mas' "$(Scripts/version)"
1616

1717
Scripts/generate_package_swift lint
1818

Scripts/package

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build_dir=.build
1414
destination_root="${build_dir}/destination"
1515
version="$(Scripts/version)"
1616

17-
printf $'==> 📦 Assembling installer package for mas %s\n' "${version}"
17+
print_header '📦 Packaging installer for mas' "${version}"
1818

1919
ditto -v "${build_dir}/apple/Products/Release/mas" "${destination_root}/mas"
2020

Scripts/release_cancel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
tag="${1}"
1414

15-
printf $'==> ❌ Canceling release for tag %s\n\n' "${tag}"
15+
print_header '❌ Canceling release for tag' "${tag}"
16+
printf $'\n'
1617

1718
bump_url="$(gh release -R https://github.com/mas-cli/mas download "${tag}" -p bump.url -O - 2>/dev/null || true)"
1819
if [[ -n "${bump_url}" ]]; then

Scripts/release_start

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ tag="${1}"
2222
title="${2}"
2323
ref="${3:-HEAD}"
2424

25-
printf $'==> 🚀 Starting release for mas %s\n\n' "${tag#v}"
25+
print_header '🚀 Starting release for mas' "${tag#v}"
26+
printf $'\n'
2627

2728
if [[ ! "${tag}" =~ '^v[[:digit:]]+(\.[[:digit:]]+)*(-(alpha|beta|rc)\.[[:digit:]]+)?$' ]]; then
2829
printf $'\'%s\' is not a valid version tag\n' "${tag}" >&2

Scripts/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
. "${0:a:h}/_setup_script"
1010

11-
printf $'==> 🧪 Testing mas %s\n' "$(Scripts/version)"
11+
print_header '🧪 Testing mas' "$(Scripts/version)"
1212

1313
Scripts/generate_package_swift test
1414

0 commit comments

Comments
 (0)