Feature request: Allow - (stdin) as input file name
I have a workflow in which I would like to use,
git show tag:foo.md | pandiff - foo.md
However, this hangs. Instead what I end up doing is,
T=$(mktemp)
git show tag:foo.md > $T
pandiff $T foo.md
So the request is that pandiff allow - as an input file without hanging.
Thanks.
I agree this should work, so +1.
In the mean time you might work around if it doesn't try to seek in the file with filename substitution:
$ pandiff <(git show tag:foo.md) foo.md
If pandiff does try to seek, then this won't work (and that should be fixed too), but it will be a little harder to fix the STDIN issue too ;-)
Victor, your construction works, which is helpful. Thanks.
If that also works then it should also be relatively trivial to implement - as an alias for STDIN.
By the way did you try this version?
$ git show tag:foo.md | pandiff /dev/stdin foo.md
No dice.
$ uname -a
Linux reacted 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$ git show tag:foo.md | pandiff /dev/stdin foo.md
[WARNING] Could not deduce format from file extension
Defaulting to markdown
pandoc: /dev/stdin: withBinaryFile: does not exist (No such device or address)
Error: 1
$
Which is strange because /dev/stdin does exist.
$ vdir /dev/stdin
lrwxrwxrwx 1 root root 15 Jan 9 15:12 /dev/stdin -> /proc/self/fd/0
$
and does work,
$ echo foo bar | cat /dev/stdin
foo bar
$
It does exist but it's a different inode type than the process redirection (<(command)) method, so that's not completely surprising.
In any case it shouldn't be too hard to fix properly so it can handle STDIN (aliased as - or otherwise).