3 # runs the less command but with some additional options.
5 # we always pass the raw flag (-r) so our special formatting is not lost.
6 # this may not be the best choice for some text terminals.
8 # there is also a "code" option added (-c) that formats the incoming data as
9 # if it were source code before showing the output. this works great on files
10 # that are actually recognized as source code, and not so great on other
11 # things like simple lists or error output.
15 if [ "$code_view_flag" == "-c" ]; then
16 # saw the 'code' flag, which means show the file with source highlighting.
18 #echo saw the code flag
21 # drop the value and emptiness will mean don't show code.
25 if [ ! -z "$code_view_flag" ]; then
26 # establish a pipe for less to see our beloved syntax highlighting.
27 export LESSOPEN="| source-highlight -f esc -o STDOUT -i %s"
30 #hmmm, will we need to iterate on the input array to get this right?
32 # run the source highlighter first if needed.
35 #hmmm: do we need to protect above from space hosings?
36 #hmmm: done, maybe. if this still works for multiple parms...