1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-06-14 22:15:13 +02:00

grep-cli: support files compressed by compress(1)

While Linux distributions (at least Arch Linux, RHEL, Debian) do not support
compressing files with compress(1), macOS & AIX do (the utility is part of
POSIX). Additionally, gzip is able to uncompress such compressed files and
provides an `uncompress` binary.

Closes #1547
This commit is contained in:
Wieland Hoffmann
2020-04-10 11:19:25 +02:00
committed by Andrew Gallant
parent 28f2a93cae
commit df7a3bfc7f
5 changed files with 23 additions and 0 deletions

View File

@ -348,6 +348,7 @@ fn default_decompression_commands() -> Vec<DecompressionCommand> {
const ARGS_LZMA: &[&str] = &["xz", "--format=lzma", "-d", "-c"];
const ARGS_BROTLI: &[&str] = &["brotli", "-d", "-c"];
const ARGS_ZSTD: &[&str] = &["zstd", "-q", "-d", "-c"];
const ARGS_UNCOMPRESS: &[&str] = &["uncompress", "-c"];
fn cmd(glob: &str, args: &[&str]) -> DecompressionCommand {
DecompressionCommand {
@ -372,5 +373,6 @@ fn default_decompression_commands() -> Vec<DecompressionCommand> {
cmd("*.br", ARGS_BROTLI),
cmd("*.zst", ARGS_ZSTD),
cmd("*.zstd", ARGS_ZSTD),
cmd("*.Z", ARGS_UNCOMPRESS),
]
}