Diff
1diff --git a/tools/changelog.sh b/tools/changelog.sh
2index 3641179e255e75db408d399ab7eda298697a5bef..e32d503b17abc7f288b422a169cd4946835843c9 100755
3--- a/tools/changelog.sh
4+++ b/tools/changelog.sh
5@@ -201,9 +201,9 @@ function display-release {
6 #* Uses $hash from outer scope
7 local hash="${1:-$hash}"
8 case "$output" in
9- raw) printf "$hash" ;;
10- text) printf "\e[33m$hash\e[0m" ;; # red
11- md) printf "[\`$hash\`](https://github.com/ohmyzsh/ohmyzsh/commit/$hash)" ;;
12+ raw) printf '%s' "$hash" ;;
13+ text) printf '\e[33m%s\e[0m' "$hash" ;; # red
14+ md) printf '[`%s`](https://github.com/ohmyzsh/ohmyzsh/commit/%s)' "$hash" ;;
15 esac
16 }
17
18@@ -215,16 +215,16 @@ function display-release {
19 case "$output" in
20 raw)
21 case "$level" in
22- 1) printf "$header\n$(printf '%.0s=' {1..${#header}})\n\n" ;;
23- 2) printf "$header\n$(printf '%.0s-' {1..${#header}})\n\n" ;;
24- *) printf "$header:\n\n" ;;
25+ 1) printf '%s\n%s\n\n' "$header" "$(printf '%.0s=' {1..${#header}})" ;;
26+ 2) printf '%s\n%s\n\n' "$header" "$(printf '%.0s-' {1..${#header}})" ;;
27+ *) printf '%s:\n\n' "$header" ;;
28 esac ;;
29 text)
30 case "$level" in
31- 1|2) printf "\e[1;4m$header\e[0m\n\n" ;; # bold, underlined
32- *) printf "\e[1m$header:\e[0m\n\n" ;; # bold
33+ 1|2) printf '\e[1;4m%s\e[0m\n\n' "$header" ;; # bold, underlined
34+ *) printf '\e[1m%s:\e[0m\n\n' "$header" ;; # bold
35 esac ;;
36- md) printf "$(printf '%.0s#' {1..${level}}) $header\n\n" ;;
37+ md) printf '%s %s\n\n' "$(printf '%.0s#' {1..${level}})" "$header" ;;
38 esac
39 }
40
41@@ -250,8 +250,8 @@ function display-release {
42
43 # Print [scope]
44 case "$output" in
45- raw|md) printf "[$scope]${padding} " ;;
46- text) printf "[\e[38;5;9m$scope\e[0m]${padding} " ;; # red 9
47+ raw|md) printf '[%s]%s ' "$scope" "$padding";;
48+ text) printf '[\e[38;5;9m%s\e[0m]%s ' "$scope" "$padding";; # red 9
49 esac
50 }
51
52@@ -264,7 +264,7 @@ function display-release {
53 subject="${(U)subject:0:1}${subject:1}"
54
55 case "$output" in
56- raw) printf "$subject" ;;
57+ raw) printf '%s' "$subject" ;;
58 # In text mode, highlight (#<issue>) and dim text between `backticks`
59 text) sed -E $'s|#([0-9]+)|\e[32m#\\1\e[0m|g;s|`([^`]+)`|`\e[2m\\1\e[0m`|g' <<< "$subject" ;;
60 # In markdown mode, link to (#<issue>) issues
61@@ -277,8 +277,8 @@ function display-release {
62 local type="${1:-${TYPES[$type]:-${(C)type}}}"
63 [[ -z "$type" ]] && return 0
64 case "$output" in
65- raw|md) printf "$type: " ;;
66- text) printf "\e[4m$type\e[24m: " ;; # underlined
67+ raw|md) printf '%s: ' "$type" ;;
68+ text) printf '\e[4m%s\e[24m: ' "$type" ;; # underlined
69 esac
70 }
71
72@@ -292,7 +292,7 @@ function display-release {
73 (( $#breaking != 0 )) || return 0
74
75 case "$output" in
76- text) fmt:header "\e[31mBREAKING CHANGES" 3 ;;
77+ text) printf '\e[31m'; fmt:header "BREAKING CHANGES" 3 ;;
78 raw) fmt:header "BREAKING CHANGES" 3 ;;
79 md) fmt:header "BREAKING CHANGES ⚠" 3 ;;
80 esac