diff options
| -rwxr-xr-x | .local/bin/woman | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/.local/bin/woman b/.local/bin/woman index c68728d..9acf7fd 100755 --- a/.local/bin/woman +++ b/.local/bin/woman @@ -1,16 +1,17 @@ -#!/usr/local/bin/andy +#!/bin/sh # TODO: -s flag to apropos -apropos . -| sed -E 's/ (\([^)]+\))\s*-/\1 —/' -| sort -| osel -| sed 's/\s.*//' -| read page +page="$(apropos . \ + | sed -E 's/ (\([^)]+\))\s*-/\1 —/' \ + | sort \ + | osel \ + | sed 's/\s.*//')" -if test -n $page -a ! -t 2 { - man -Tpdf $page | zathura - -} else if test -n $page -a -t 2 { - man $page -} +if [ -n "$page" -a ! -t 2 ] +then + man -Tpdf "$page" | zathura - +elif [ -n "$page" -a -t 2 ] +then + man "$page" +fi |