Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify documentation of -c/--stdout #2731

Closed
comex opened this issue Jul 25, 2021 · 3 comments
Closed

Clarify documentation of -c/--stdout #2731

comex opened this issue Jul 25, 2021 · 3 comments
Assignees
Labels
documentation release-blocking Must be done by the release

Comments

@comex
Copy link

comex commented Jul 25, 2021

Describe the bug
I want the zstd CLI to read from a file and decompress it to stdout.

As I just learned, this can be done with zstd -d -c foo.zst. The -c option makes it decompress to stdout, whereas the default when an input filename is passed is to create a correspondingly named output file.

However, I was not expecting -c to work and only tried it after spending some time looking for other options. This is because it's documented (in both the --help output and the man page) as:

-c : force write to standard output, even if it is the console

The "even if it is the console" part refers to what happens if zstd is in compression mode and not given a filename. It reads uncompressed data from stdin and writes compressed data to stdout, but if stdout is a tty, it instead prints stdout is a console, aborting. This behavior can be suppressed with -c.

Based on the description and the option naming ('c' for console?), I thought suppressing this check was the sole effect of -c. Perhaps if I had read the man page first, -c's long alias of --stdout would have made me more likely to try it, but I started with the --help output. And my intuition was that "disable tty check" and "output to stdout instead of somewhere else" would be different options.

So perhaps the description can be clarified a bit.

P.S.: One thing I tried before learning about -c was zstd -d -o - foo.zst, which resulted in the very confusing message error: command cannot be separated from its argument by another command. It would be nice to improve the error message here, or perhaps even make -o - work.

@terrelln
Copy link
Contributor

terrelln commented Jul 26, 2021

We should improve the documentation, but I believe that passing -f will override the console detection.

So zstd -c -f foo or zstd -c -f -d foo.zst.

@abxhr
Copy link
Contributor

abxhr commented Sep 23, 2021

To clarify, where in the documentation would need the change?

@terrelln terrelln added the release-blocking Must be done by the release label Nov 24, 2021
@binhdvo
Copy link
Contributor

binhdvo commented Nov 29, 2021

Documentation has been updated to make the behavior more clear

@binhdvo binhdvo closed this as completed Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation release-blocking Must be done by the release
Projects
None yet
Development

No branches or pull requests

4 participants