Menu

#14 Outputs to file rather than stdout when multiple input files provided

stable_release
closed-fixed
None
5
2017-03-18
2017-02-23
Andy
No

highlight 3.34

I may be misunderstanding the docs, but this behavior is surprising to me and I don't know how to avoid it.

highlight -O truecolor --force <a_file>

sends the output to stdout, as expected and desired.

highlight -O truecolor --force <a_file> <a_second_file>

writes the output to files in the current directory, with ".xterm" extensions. Is this intentional? What is the proper way to output from multiple input files to stdout?

Discussion

  • André Simon

    André Simon - 2017-02-24

    Hi Andy,

    this is indeed intentional, the README says:

    Highlight enters the batch processing mode if multiple input files are defined
    or if --batch-recursive is set.
    In batch mode, highlight will save the generated files using the original
    filename, appending the extension of the chosen output type.

    This is imho the intuitive handling of the other output formats like HTML, RTF, TeX etc.

    If all input files have the same syntax, you can use a pipe:

    cat file1.c file2.c | highlight --out-format truecolor --force -Sc
    

    For handling mixed input files properly, a new flag like --stdout would be needed.

     
  • André Simon

    André Simon - 2017-02-24
    • status: open --> pending
    • assigned_to: André Simon
     
  • André Simon

    André Simon - 2017-02-24

    A new option --stdout was added in SVN. Release will be sometime next week.

     
  • Andy

    Andy - 2017-02-24

    Thank you!

     
  • André Simon

    André Simon - 2017-03-18
    • status: pending --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.