Pretty Print source code

카테고리 없음 2010. 6. 22. 16:39

Pretty-print source code with enscript (See related posts)

man enscript
open http://trac.macports.org/wiki/InstallingMacPorts
sudo port install enscript

alias enscript='/opt/local/bin/enscript'
man enscript
enscript --help
enscript --list-media
enscript --help-highlight | less
enscript --help-pretty-print | less
# list available fonts for man enscript
cat -n /usr/share/enscript/font.map
man pstopdf # cf. http://codesnippets.joyent.com/posts/show/1601

FILE="/usr/include/sys/stat.h"
enscript -q -C -Ec --color -f Courier10 -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
enscript -q -B -C -Ec --color -f Courier10 -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
enscript -q -B -C -Ec -G --color -f Courier10 -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
enscript -q -B -C -Ec -G --color --word-wrap -f Courier10 -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
enscript -q -B -C -Ec -G --color --word-wrap -f Courier10 -MLetter -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
enscript -q -B -C -Ec -G --color --word-wrap -f Courier7 -MA4 -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
enscript -q -B -C -Ec -G --color --word-wrap -f Courier7 -MA4 -T4 -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
open -a Preview ~/Desktop/test.pdf

FILE="/usr/bin/isc-config.sh"
enscript -q -B -C -Esh -G --color --word-wrap -f Courier7 -MA4 -T4 -p - "$FILE" | pstopdf -i -o ~/Desktop/test.pdf
open -a Preview ~/Desktop/test.pdf
: