Created
January 7, 2021 21:51
-
-
Save xpe/1ee7ac7e7fee4c189db303619d50258c to your computer and use it in GitHub Desktop.
View a man page as PDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
(( $# == 1 )) || {print -u2 "One argument required"; exit -1} | |
[[ $1 ]] || {print -u2 "First argument is empty"; exit -1} | |
local dir=$HOME/.man_cache/ps | |
[[ -d $dir ]] || mkdir -p $dir | |
local file=$dir/$1.ps | |
[[ -f $file ]] || man -t $1 > $file | |
[[ -s $file ]] && open -a Preview $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: Add usage text.