summaryrefslogtreecommitdiff
path: root/.local/bin/woman
blob: 9acf7fdc490e3e8d9198491374c21dbe9c3b3bf5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

# TODO: -s flag to apropos

page="$(apropos . \
	| sed -E 's/ (\([^)]+\))\s*-/\1 —/' \
	| sort \
	| osel \
	| sed 's/\s.*//')"

if [ -n "$page" -a ! -t 2 ]
then
	man -Tpdf "$page" | zathura -
elif [ -n "$page" -a -t 2 ]
then
	man "$page"
fi