kiss: Simplify listing of extensions

This commit is contained in:
Dylan Araps 2020-05-22 13:52:22 +03:00
parent 368484b24a
commit e9fbcc6f13
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 6 additions and 5 deletions

11
kiss
View File

@ -1471,16 +1471,17 @@ args() {
log "Installed extensions (kiss-* in \$PATH)"
set --
# shellcheck disable=2046
# see [1] at top of script.
set -- $(KISS_PATH=$PATH pkg_find kiss-\* all -x)
for path in $(KISS_PATH=$PATH pkg_find kiss-\* all -x); do
[ -x "$path" ] && set -- "${path#*/kiss-}" "$@"
max=$((${#1} > max ? ${#1} : max))
for path do
p=${path#*/kiss-} max=$((${#p} > max ? ${#p}+1 : max))
done
for path do
printf "%b->%b %-${max}s " "$lcol" "$lclr" "${path#*/kiss-}"
sed -n 's/^# *//;2p' "$(command -v "kiss-$path")"
sed -n 's/^# *//;2p' "$path"
done | sort -uk1 >&2
;;