-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
zstdless handles all options with zstdcat, not allowing anything to be passed to less.
To Reproduce
Steps to reproduce the behavior:
echo foo | zstd -o foo.zst
zstdless +/foo foo.zst
(to search directly forfoo
) →zstd: can't stat +/foo: No such file or directory -- ignored
(on stderr, only visible after less is closed)zstdless -N foo.zst
→Incorrect parameters
cat foo.zst | zstdless +/foo
(imagine thecat
were actually acurl
or similar) → as 2.
Expected behavior
I'd expect the same behaviour as zless, which does pass such options on to less. However, zstd options may be needed for decompressing the zstd file in the first place, e.g. -D
to specify a dictionary, and some of these collide with ones from less, e.g. -M
. gzip's zless does not have this problem because it doesn't have any relevant options.
Not sure whether there is a good solution to this problem. I'm also not sure whether it'd be more common to pass zstd options or less options to zstdless; otherwise, the user could be instructed to use an explicit zstdcat | less
for the less common one. Backward compatibility may be another concern since everything is passed to zstdcat currently. If this behaviour is the desired one, that should at least be documented clearly on the man page though.
Additional context
Similar to the zstdgrep inconsistencies at #2064