1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-23 15:40:07 -07:00

misc: nit

This commit is contained in:
Dylan Araps 2021-07-05 11:42:52 +03:00
parent b1945ba3bf
commit e89f1d1af4
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

11
kiss
View File

@ -27,7 +27,7 @@
log() { log() {
printf '%b%s %b%s%b %s\n' \ printf '%b%s %b%s%b %s\n' \
"$lcol" "${3:-->}" "${lclr}${2:+$lcol2}" "$1" "$lclr" "$2" >&2 "$c1" "${3:-->}" "${c3}${2:+$c2}" "$1" "$c3" "$2" >&2
} }
war() { war() {
@ -1659,7 +1659,7 @@ args() {
# Print each extension, grab its description from the second line # Print each extension, grab its description from the second line
# in the file and align the output based on the above max. # in the file and align the output based on the above max.
for path do for path do
printf "%b->%b %-${max}s " "$lcol" "$lclr" "${path#*/kiss-}" printf "%b->%b %-${max}s " "$c1" "$c3" "${path#*/kiss-}"
sed -n 's/^# *//;2p' "$path" sed -n 's/^# *//;2p' "$path"
done >&2 done >&2
;; ;;
@ -1713,9 +1713,10 @@ main() {
# Globally disable globbing and enable exit-on-error. # Globally disable globbing and enable exit-on-error.
set -ef set -ef
# Allow the user to disable colors in output via an environment variable. # Color can be disabled via the environment variable KISS_COLOR. Colors are
# Check this once so as to not slow down printing. # also automatically disabled if output is being used in a pipe/redirection.
[ "$KISS_COLOR" = 0 ] || lcol='\033[1;33m' lcol2='\033[1;34m' lclr='\033[m' [ "$KISS_COLOR" = 0 ] || ! [ -t 2 ] ||
c1='\033[1;33m' c2='\033[1;34m' c3='\033[m'
# Store the original working directory to ensure that relative paths # Store the original working directory to ensure that relative paths
# passed by the user on the command-line properly resolve to locations # passed by the user on the command-line properly resolve to locations