citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

pdfnow (367B)


      1 #!/usr/bin/env bash
      2 
      3 usage () {
      4   printf "usage: pdfnow file.md OR <file.md pdfnow [markdown]\n" >&2
      5   exit 1
      6 }
      7 
      8 outfile="$(mktemp)".pdf
      9 
     10 if [ -t 0 ]; then
     11   [ $# -eq 0 ] && usage
     12   /home/jb55/bin/pdfsave "$1" "$outfile"
     13 else
     14   ext="${1:-markdown}"
     15   /home/jb55/bin/pdfsave "$outfile" "$ext"
     16 fi
     17 
     18 printf "%s\n" "$outfile"
     19 zathura "$outfile" &>/dev/null
     20 
     21 rm "$outfile"