diff options
author | noreply@github.com <noreply@github.com> | 2020-01-22 16:53:01 +0000 |
---|---|---|
committer | noreply@github.com <noreply@github.com> | 2020-01-22 16:53:01 +0000 |
commit | f77a4ca9051228c096f0d55227c7ce0732cb2c7c (patch) | |
tree | 4cc4e709e42d3e27818f2deaa66fc37106b537d2 /kiss | |
parent | fa6c3ca3ee14909c1949c018ae6833b24259ed6f (diff) | |
parent | 8ebb4a033e940452cf439635002ec83548582cee (diff) | |
download | cpt-f77a4ca9051228c096f0d55227c7ce0732cb2c7c.tar.gz |
Merge pull request #88 from E5ten/master
log: replace use of literal escape code error with printf %b
FossilOrigin-Name: e5c5f79a9408f440d0eda0d4e323528abb9a97880c08214c448f81a4defc572b
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -15,17 +15,13 @@ log() { # Print a message prettily. # - # This function uses the literal escape character (Ctrl+V+Escape) as - # a simple way of *safely* bypassing the escape sequence restrictions - # on 'printf %s'. Cheeky, I know. - # - # '\033[1;32m' Set text to color '2' and make it bold. - # '\033[m': Reset text formatting. - # '${3:-->}': If the 3rd argument is missing, set prefix to '->'. - # '${2:+[1;3Xm}': If the 2nd argument exists, set the text style of '$1'. - # '${2:+[m}': If the 2nd argument exists, reset text formatting. - printf '\033[1;33m%s \033[m%s\033[m %s\n' \ - "${3:-->}" "${2:+[1;36m}$1${2:+[m}" "$2" + # '\033[1;32m' Set text to color '2' and make it bold. + # '\033[m': Reset text formatting. + # '${3:-->}': If the 3rd argument is missing, set prefix to '->'. + # '${2:+\033[1;3Xm}': If the 2nd argument exists, set text style of '$1'. + # '${2:+\033[m}': If the 2nd argument exists, reset text formatting. + printf '\033[1;33m%s \033[m%b%s\033[m %s\n' \ + "${3:-->}" "${2:+\033[1;36m}" "$1" "$2" } die() { |