jgm/pandoc

Support using stdin for arguments that take files in cross-platform agnostic way

Open

#6987 aperta il 27 dic 2020

Vedi su GitHub
 (6 commenti) (0 reazioni) (0 assegnatari)Haskell (3850 fork)batch import
CLIenhancementgood first issue

Metriche repository

Star
 (44.133 star)
Metriche merge PR
 (Merge medio 7g) (7 PR mergiate in 30 g)

Descrizione

(First of all: yes, I know that Unix-alikes has /dev/stdin that can serve as a file-like standin. That's useless to me when using Windows which lacks such a thing entirely.)

Introduction / Context

Most workflows tend to be born out of necessity. You code something, you make it work, and (assuming they are a regular part of your workflow) you rewrite parts every few months as you come across new requirements or edge cases. That is how I have ended up with a folder of Python scripts that rely on pandoc for a considerable number of manipulations that are mostly quite specific to the scripts themselves. Most of these have accompanying template and/or filter files, but you can imagine that has gotten quite chaotic, especially with some files having become outright abandoned as my needs changed.

Themselves, they are not a pandoc 'problem' at all, but it made me realize that having these parts of the process in separate files is often detrimental a few months down the road in understanding what is actually going on. (I have plenty of comments in my Python code, but those rarely cover the questions I have when something involving pandoc doesn't work quite right!)

Without such means, one way I could 'clean up' this aspect during my upcoming improvement work is by writing a temporary file with the intended filter for every invocation... but that is an unneeded performance hit. Or I could just do nothing at all and keep hating myself every time I have to dig into one of those scripts...

The request

It would be nice if, for commandline arguments that accept a file from the filesystem, there was some sort of cross-platform syntax that would make it read that parameter from standard input.

I realize that there is only one stdin which would limit this functionality to being used in just one argument at a time, but since that covers over half of my script-based pandoc invocations, so it would still make a considerable impact for me personally.

However...

If nobody else sees a use for such a feature, feel free to throw this request in the digital bin. Never before have I been accused of being a user matching the common stereotypes. 😸

Guida contributor