Skip to content

Instantly share code, notes, and snippets.

@xpe
Created January 7, 2021 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpe/1ee7ac7e7fee4c189db303619d50258c to your computer and use it in GitHub Desktop.
Save xpe/1ee7ac7e7fee4c189db303619d50258c to your computer and use it in GitHub Desktop.
View a man page as PDF
#!/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
@xpe
Copy link
Author

xpe commented Jan 7, 2021

TODO: Add usage text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment