Ben Coman <btc@openinworld.com> writes:
Hi all,
./compile.sh can be passed a parameter to compile only a specific file
rather than the whole book. Now I consider this probably only occurs
during development with a human executing the script (rather than some
CI process which will be processing the whole book) and I'm finding it
useful to automatically fire off a PDF Viewer on the generated file, as
per the line below tagged "ADDED".
if [[ $# -eq 1 ]]; then
dir=$(dirname "$1") # e.g., Zinc
pier_file=$(basename "$1") # e.g., Zinc.pier
pillar_one "$1"
produce_pdf "${dir}" "${pier_file}"
open "${dir}"/"${pier_file}".pdf # <----ADDED
The `open' tool is OSX-specific, isn't it?
Probably Yes. And even on OSX someone may want to use a different
tool. That is why I below :) I suggest using an environment variable so
the command can be customized outside the controlled compile.sh file,
and do nothing if that environment variable doesn't exist.