mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2023-02-13 20:55:19 -05:00
Adding macho man scripts.
This commit is contained in:
parent
4680c2e1ec
commit
c015df8e92
2 changed files with 37 additions and 0 deletions
12
macho-gui.sh
Executable file
12
macho-gui.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
manual=$(apropos -s ${SECTION:-''} ${@:-.} | \
|
||||
grep -v -E '^.+ \(0\)' |\
|
||||
awk '{print $2 " " $1}' | \
|
||||
sort | \
|
||||
dmenu -i -p "Manual: " | \
|
||||
sed -E 's/^\((.+)\)/\1/')
|
||||
|
||||
if [ -z "$MANUAL" ]; then
|
||||
man -T${FORMAT:-pdf} $manual | ${READER:-zathura -}
|
||||
fi
|
25
macho.sh
Executable file
25
macho.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
export FZF_DEFAULT_OPTS='
|
||||
--height=30%
|
||||
--layout=reverse
|
||||
--prompt="Manual: "
|
||||
--preview="echo {1} | sed -E \"s/^\((.+)\)/\1/\" | xargs -I{S} man -Pcat {S} {2} 2>/dev/null"'
|
||||
|
||||
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 | \
|
||||
fzf | \
|
||||
sed -E 's/^\((.+)\)/\1/')
|
||||
|
||||
[ -z "$manual" ] && exit 0
|
||||
man $manual
|
Loading…
Reference in a new issue