Nicolas Petton wrote:
Ben Coman <b...@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.
cheers -ben
  
else
     pillar_all
     compile_chapters
     compile_latex_book
fi


Is this something others would find useful? or can you see issues with 
it?  Having this mod makes my working area dirty, and 'git clean' blows 
it away - so I'd like to integrate something like it. Now the above 
works for me on OSX, but for flexibility to deal with other platforms, 
the "open" command could be replaced with an environment variable, and 
do nothing if environment variable does not exist.

What do you think?
    


Reply via email to