dotfiles/.bin/dexec_man

11 lines
415 B
Plaintext
Raw Normal View History

2022-12-06 08:01:44 +01:00
#!/bin/sh
. $HOME/.bin/_config
2023-03-06 08:14:38 +01:00
MAN="$(for i in $(jot 9 1); do man -s $i -k . | awk -v i=$i -F"(" '{ gsub(", ","\n"i"-",$1); print i"-"$1}'; done | while IFS= read -r l; do echo "${#l} $((++n)) $l"; done | sort -n -k 1 | cut -d" " -f3- | $DMENU_CMD -p "Manpage")"
2022-12-06 08:01:44 +01:00
if [ ! -z "$MAN" ]; then
M="$(printf '%s' "$MAN" | cut -d"-" -f2)"
S="$(printf '%s' "$MAN" | cut -d"-" -f1)"
bterm -e man -s "$S" "$M"
fi