Write output to stdout
nichtich opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
SVG output should be pipe-able.
Describe the solution you'd like
mmdc -i input.mmd -o - # emit SVG by default
mmdc -i input.mmd -e pdf -o - # emit PDF (if possible, I only need SVG)
Describe alternatives you've considered
I tried process substitution:
mmdc -i input.mmd -o >( tee output.svg )
but mmdc complains because the temporary output file in /dev/fd
lacks file extension.
Manually creating a named pipe with mkfifo
works, but this requires a more complex bash script:
mkfifo tmp.svg
cat tmp.svg | tee output.svg
mmdc -i input.mmd -o tmp.svg
rm tmp.svg
My attempt was to use mmdc -o /dev/stdout
, but that has the same problem process substitution does: no file extension. Support for -o -
to write to stdout would definitely be the cleanest solution here.
I don't think there's any reason to restrict -o -
to SVG output only, since the -e
flag already exists. A command line like mmdc -o - -e png | imgcat
should work for example.