.sh

Multi-shell dotfiles manager
git clone https://git.torresjrjr.com/.sh.git
Log | Files | Refs | README | LICENSE

commit c849a18203f8327aed3a03669e5d1c44d74acae4
parent 30ba244d9396dca0a9f26b3a33b48c89ca63b4f8
Author: Byron Torres <b@torresjrjr.com>
Date:   Fri, 15 Oct 2021 03:17:06 +0100

lf*: Use awk for portable escapes

Diffstat:
Mbin/lf | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/bin/lf b/bin/lf @@ -1,14 +1,13 @@ #!/bin/sh -eu list() { - esc=$'\x1b' ( env printf '\x1b[01;34;4m%s\x1b[0m\n' "$(pwd)" ls -FAXC -w 76 --color --group-directories-first "$@" \ - | sed -E \ - -e '/:$/,$s/^.*[^:]$/ \0/' \ - -e "s/^(.*):\$/${esc}[01;34m\1${esc}[0m:/" \ - -e '/^$/d' + | awk ' + /:$/ {printf "\x1b[01;34m" $0 "\x1b[0m\n"} + /^.*[^:]$/ {printf " " $0 "\n"} + ' ) \ | more -f }