added macho man page finder with dmenu
This commit is contained in:
parent
9e6228e86a
commit
f60abea7c7
23
.local/bin/tools/mand
Executable file
23
.local/bin/tools/mand
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# macho - an interactive man page finder using fzf
|
||||||
|
# from: https://hiphish.github.io/blog/2020/05/31/macho-man-command-on-steroids/
|
||||||
|
|
||||||
|
while getopts ":s:" opt; do
|
||||||
|
case $opt in
|
||||||
|
s ) SECTION=$OPTARG; shift; shift;;
|
||||||
|
\?) echo "Invalid option: -$OPTARG" >&2; exit 1;;
|
||||||
|
: ) echo "Option -$OPTARG requires an argument" >&2; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
manual=$(apropos -s ${SECTION:-''} ${@:-.} | \
|
||||||
|
grep -v -E '^.+ \(0\)' |\
|
||||||
|
awk '{print $2 " " $1}' | \
|
||||||
|
sort | \
|
||||||
|
dmenu -i -l 20 -p "Manual: " | \
|
||||||
|
sed -E 's/^\((.+)\)/\1/')
|
||||||
|
|
||||||
|
echo $manual
|
||||||
|
[ -z "$manual" ] && exit 0;
|
||||||
|
|
||||||
|
man -T"${FORMAT:-pdf}" $manual | ${READER:-zathura} -
|
Loading…
Reference in New Issue
Block a user