Skip to content

Take input files from stdin (standard input)#280

Merged
BlackIkeEagle merged 1 commit into
Parchive:masterfrom
desertwitch:stdin-filelist
May 6, 2026
Merged

Take input files from stdin (standard input)#280
BlackIkeEagle merged 1 commit into
Parchive:masterfrom
desertwitch:stdin-filelist

Conversation

@desertwitch
Copy link
Copy Markdown
Contributor

This extends upon #273 and #279.

I always missed this in par2cmdline and since the logic is already in place,
it would now be nice to use the error-case where @ is followed by nothing
for taking the input from standard input, arguably a common Linux use-case.

This would allow for setups like:

desertwitch@vDebianDev:~/par2cmdline$ cat test.txt | ./par2 c test.par2 @
Block size: 16
Source file count: 2
Source block count: 1506
Recovery block count: 75
Recovery file count: 7

Opening: README.md
Opening: ROADMAP
Computing Reed Solomon matrix.
Constructing: done.
Wrote 1200 bytes to disk
Writing recovery packets
Writing verification packets
Done

And especially use in shell-scripting feeding other command's output into par2cmdline.

@Rhialto
Copy link
Copy Markdown

Rhialto commented Apr 21, 2026

For the case of reading from standard input, it is more common on Unix to use - as the file name. So you'd have @-.
@/dev/stdin would also work, if you have that special file on your system.

@desertwitch
Copy link
Copy Markdown
Contributor Author

I used @ because it eliminates an existing error path and requires no additional code to handle.
Arguably the cleanest would be using - instead of @ or @-...
I'd be happy either way, as long as the possibility to use standard input is implemented.

@BlackIkeEagle
Copy link
Copy Markdown
Member

Interesting discussion, but currently I'm leaning more to how it is implemented now, since - usually implies you are streaming some data in, if we use - for the filelist only it might be confusing

@BlackIkeEagle BlackIkeEagle merged commit 84dd09a into Parchive:master May 6, 2026
@BlackIkeEagle BlackIkeEagle mentioned this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants