diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-10-06 16:15:41 +0200 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2021-10-06 16:15:43 +0200 |
commit | 2f595f9029dc65228788d999c5e4766280ffc3d0 (patch) | |
tree | 44dff3cfb2c5ececdc5f4bb6091f076bbbc9c33a /scripts | |
parent | 62d23b18d89eba11596d194b35257b0b7821795d (diff) | |
download | man-pages-2f595f9029dc65228788d999c5e4766280ffc3d0.tar.gz |
scripts/bash_aliases: pdfman(): Generalize the tool
Accept man(1) syntax, so that the function can open
system manual pages by [optional] section and page name.
As a side effect, this simplifies the invocation of man(1),
which didn't need '-l'.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bash_aliases | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/bash_aliases b/scripts/bash_aliases index ecac0029de..be0672595a 100644 --- a/scripts/bash_aliases +++ b/scripts/bash_aliases @@ -173,15 +173,14 @@ function man_lsvar() function pdfman() { - if (($# != 1)); then - >&2 echo "Usage: ${FUNCNAME[0]} <man-page.n>"; + if (($# == 0)); then + >&2 echo "Usage: ${FUNCNAME[0]} [man(1) options] [section] page"; return ${EX_USAGE}; fi; - local tmp="$(mktemp -t "${1##*/}.XXXXXX")"; + local tmp="$(mktemp -t "${!###*/}.XXXXXX")"; - <${1} \ - man -Tps -l - \ + man -Tps $@ \ |ps2pdf - - \ >${tmp}; xdg-open ${tmp}; |