Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion programs/zstdcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static void usage(FILE* f, const char* programName)
DISPLAY_F(f, "Compress or decompress the INPUT file(s); reads from STDIN if INPUT is `-` or not provided.\n\n");
DISPLAY_F(f, "Usage: %s [OPTIONS...] [INPUT... | -] [-o OUTPUT]\n\n", programName);
DISPLAY_F(f, "Options:\n");
DISPLAY_F(f, " -o OUTPUT Write output to a single file, OUTPUT.\n");
DISPLAY_F(f, " -o, --output OUTPUT Write output to a single file, OUTPUT.\n");
DISPLAY_F(f, " -c, --stdout Write to STDOUT (even if it is a console) and keep the INPUT file(s).\n");
DISPLAY_F(f, " -k, --keep Preserve INPUT file(s). [Default] \n");
DISPLAY_F(f, " --rm Remove INPUT file(s) after successful (de)compression to file.\n");
Expand Down Expand Up @@ -1139,6 +1139,7 @@ int main(int argCount, const char* argv[])
continue;
}
#endif
if (longCommandWArg(&argument, "--output")) { NEXT_FIELD(outFileName); continue; }
#ifndef ZSTD_NOTRACE
if (longCommandWArg(&argument, "--trace")) { char const* traceFile; NEXT_FIELD(traceFile); TRACE_enable(traceFile); continue; }
#endif
Expand Down
13 changes: 13 additions & 0 deletions tests/cli-tests/basic/output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

echo "some data" > file

println "+ zstd -q file --output compressed.zst"
zstd -q file --output compressed.zst
test -f compressed.zst || die "Expected --output to create compressed.zst"

println "+ zstd -q -d compressed.zst --output roundtrip"
zstd -q -d compressed.zst --output roundtrip
cmp file roundtrip || die "Expected --output decompression to round-trip"

exit 0