mirror of
https://github.com/ouch-org/ouch.git
synced 2025-07-18 23:50:35 +00:00
Merge 98574002e103d9f9f15f5c6815fbb9ebdbca98f3 into 945ffde551848b7e8c92e6f4de7483b0f339a5de
This commit is contained in:
commit
daafc08617
@ -25,6 +25,7 @@ Categories Used:
|
|||||||
- Merge folders in decompression [\#798](https://github.com/ouch-org/ouch/pull/798) ([tommady](https://github.com/tommady))
|
- Merge folders in decompression [\#798](https://github.com/ouch-org/ouch/pull/798) ([tommady](https://github.com/tommady))
|
||||||
- Add `--no-smart-unpack` flag to decompression command to disable smart unpack [\#809](https://github.com/ouch-org/ouch/pull/809) ([talis-fb](https://github.com/talis-fb))
|
- Add `--no-smart-unpack` flag to decompression command to disable smart unpack [\#809](https://github.com/ouch-org/ouch/pull/809) ([talis-fb](https://github.com/talis-fb))
|
||||||
- Provide Nushell completions (packages still need to install them) [\#827](https://github.com/ouch-org/ouch/pull/827) ([FrancescElies](https://github.com/FrancescElies))
|
- Provide Nushell completions (packages still need to install them) [\#827](https://github.com/ouch-org/ouch/pull/827) ([FrancescElies](https://github.com/FrancescElies))
|
||||||
|
- Add aliases for comic book archives [\#835](https://github.com/ouch-org/ouch/pull/835https://github.com/ouch-org/ouch/pull/835) ([md9753](https://github.com/md9753))
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
|
@ -125,7 +125,11 @@ Output:
|
|||||||
If you wish to exclude non-free code from your build, you can disable RAR support
|
If you wish to exclude non-free code from your build, you can disable RAR support
|
||||||
by building without the `unrar` feature.
|
by building without the `unrar` feature.
|
||||||
|
|
||||||
`tar` aliases are also supported: `tgz`, `tbz`, `tbz2`, `tlz4`, `txz`, `tlzma`, `tsz`, `tzst`.
|
Aliases for these formats are also supported:
|
||||||
|
- `tar`: `tgz`, `tbz`, `tbz2`, `tlz4`, `txz`, `tlzma`, `tsz`, `tzst`, `cbt`
|
||||||
|
- `zip`: `cbz`
|
||||||
|
- `7z`: `cb7`
|
||||||
|
- `rar`: `cbr`
|
||||||
|
|
||||||
Formats can be chained:
|
Formats can be chained:
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ pub const SUPPORTED_EXTENSIONS: &[&str] = &[
|
|||||||
"br",
|
"br",
|
||||||
];
|
];
|
||||||
|
|
||||||
pub const SUPPORTED_ALIASES: &[&str] = &["tgz", "tbz", "tlz4", "txz", "tzlma", "tsz", "tzst"];
|
pub const SUPPORTED_ALIASES: &[&str] = &["tgz", "tbz", "tlz4", "txz", "tzlma", "tsz", "tzst", "cbt", "cbz", "cb7", "cbr"];
|
||||||
|
|
||||||
#[cfg(not(feature = "unrar"))]
|
#[cfg(not(feature = "unrar"))]
|
||||||
pub const PRETTY_SUPPORTED_EXTENSIONS: &str = "tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, 7z";
|
pub const PRETTY_SUPPORTED_EXTENSIONS: &str = "tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, 7z";
|
||||||
#[cfg(feature = "unrar")]
|
#[cfg(feature = "unrar")]
|
||||||
pub const PRETTY_SUPPORTED_EXTENSIONS: &str = "tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z";
|
pub const PRETTY_SUPPORTED_EXTENSIONS: &str = "tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z";
|
||||||
|
|
||||||
pub const PRETTY_SUPPORTED_ALIASES: &str = "tgz, tbz, tlz4, txz, tzlma, tsz, tzst";
|
pub const PRETTY_SUPPORTED_ALIASES: &str = "tgz, tbz, tlz4, txz, tzlma, tsz, tzst, cbt, cbz, cb7, cbr";
|
||||||
|
|
||||||
/// A wrapper around `CompressionFormat` that allows combinations like `tgz`
|
/// A wrapper around `CompressionFormat` that allows combinations like `tgz`
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@ -89,16 +89,16 @@ pub enum CompressionFormat {
|
|||||||
Lzma,
|
Lzma,
|
||||||
/// .sz
|
/// .sz
|
||||||
Snappy,
|
Snappy,
|
||||||
/// tar, tgz, tbz, tbz2, tbz3, txz, tlz4, tlzma, tsz, tzst
|
/// tar, tgz, tbz, tbz2, tbz3, txz, tlz4, tlzma, tsz, tzst, cbt
|
||||||
Tar,
|
Tar,
|
||||||
/// .zst
|
/// .zst
|
||||||
Zstd,
|
Zstd,
|
||||||
/// .zip
|
/// .zip, .cbz
|
||||||
Zip,
|
Zip,
|
||||||
// even if built without RAR support, we still want to recognise the format
|
// even if built without RAR support, we still want to recognise the format
|
||||||
/// .rar
|
/// .rar, .cbr
|
||||||
Rar,
|
Rar,
|
||||||
/// .7z
|
/// .7z, .cb7
|
||||||
SevenZip,
|
SevenZip,
|
||||||
/// .br
|
/// .br
|
||||||
Brotli,
|
Brotli,
|
||||||
@ -125,7 +125,7 @@ impl CompressionFormat {
|
|||||||
fn to_extension(ext: &[u8]) -> Option<Extension> {
|
fn to_extension(ext: &[u8]) -> Option<Extension> {
|
||||||
Some(Extension::new(
|
Some(Extension::new(
|
||||||
match ext {
|
match ext {
|
||||||
b"tar" => &[Tar],
|
b"tar" | b"cbt" => &[Tar],
|
||||||
b"tgz" => &[Tar, Gzip],
|
b"tgz" => &[Tar, Gzip],
|
||||||
b"tbz" | b"tbz2" => &[Tar, Bzip],
|
b"tbz" | b"tbz2" => &[Tar, Bzip],
|
||||||
b"tbz3" => &[Tar, Bzip3],
|
b"tbz3" => &[Tar, Bzip3],
|
||||||
@ -133,7 +133,7 @@ fn to_extension(ext: &[u8]) -> Option<Extension> {
|
|||||||
b"txz" | b"tlzma" => &[Tar, Lzma],
|
b"txz" | b"tlzma" => &[Tar, Lzma],
|
||||||
b"tsz" => &[Tar, Snappy],
|
b"tsz" => &[Tar, Snappy],
|
||||||
b"tzst" => &[Tar, Zstd],
|
b"tzst" => &[Tar, Zstd],
|
||||||
b"zip" => &[Zip],
|
b"zip" | b"cbz" => &[Zip],
|
||||||
b"bz" | b"bz2" => &[Bzip],
|
b"bz" | b"bz2" => &[Bzip],
|
||||||
b"bz3" => &[Bzip3],
|
b"bz3" => &[Bzip3],
|
||||||
b"gz" => &[Gzip],
|
b"gz" => &[Gzip],
|
||||||
@ -141,8 +141,8 @@ fn to_extension(ext: &[u8]) -> Option<Extension> {
|
|||||||
b"xz" | b"lzma" => &[Lzma],
|
b"xz" | b"lzma" => &[Lzma],
|
||||||
b"sz" => &[Snappy],
|
b"sz" => &[Snappy],
|
||||||
b"zst" => &[Zstd],
|
b"zst" => &[Zstd],
|
||||||
b"rar" => &[Rar],
|
b"rar" | b"cbr" => &[Rar],
|
||||||
b"7z" => &[SevenZip],
|
b"7z" | b"cb7" => &[SevenZip],
|
||||||
b"br" => &[Brotli],
|
b"br" => &[Brotli],
|
||||||
_ => return None,
|
_ => return None,
|
||||||
},
|
},
|
||||||
|
@ -17,13 +17,16 @@ fn sanity_check_through_mime() {
|
|||||||
write_random_content(test_file, &mut SmallRng::from_entropy());
|
write_random_content(test_file, &mut SmallRng::from_entropy());
|
||||||
|
|
||||||
let formats = [
|
let formats = [
|
||||||
"7z", "tar", "zip", "tar.gz", "tgz", "tbz", "tbz2", "txz", "tlzma", "tzst", "tar.bz", "tar.bz2", "tar.lzma",
|
"7z", "cb7", "tar", "cbt", "zip", "cbz", "tar.gz", "tgz", "tbz", "tbz2", "txz", "tlzma", "tzst",
|
||||||
"tar.xz", "tar.zst",
|
"tar.bz", "tar.bz2", "tar.lzma", "tar.xz", "tar.zst",
|
||||||
];
|
];
|
||||||
|
|
||||||
let expected_mimes = [
|
let expected_mimes = [
|
||||||
|
"application/x-7z-compressed",
|
||||||
"application/x-7z-compressed",
|
"application/x-7z-compressed",
|
||||||
"application/x-tar",
|
"application/x-tar",
|
||||||
|
"application/x-tar",
|
||||||
|
"application/zip",
|
||||||
"application/zip",
|
"application/zip",
|
||||||
"application/gzip",
|
"application/gzip",
|
||||||
"application/gzip",
|
"application/gzip",
|
||||||
|
@ -7,7 +7,7 @@ expression: "run_ouch(\"ouch decompress a\", dir)"
|
|||||||
- Decompression formats are detected automatically from file extension
|
- Decompression formats are detected automatically from file extension
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst, cbt, cbz, cb7, cbr
|
||||||
hint:
|
hint:
|
||||||
hint: Alternatively, you can pass an extension to the '--format' flag:
|
hint: Alternatively, you can pass an extension to the '--format' flag:
|
||||||
hint: ouch decompress <TMP_DIR>/a --format tar.gz
|
hint: ouch decompress <TMP_DIR>/a --format tar.gz
|
||||||
|
@ -8,4 +8,4 @@ expression: "run_ouch(\"ouch decompress a b.unknown\", dir)"
|
|||||||
- Decompression formats are detected automatically from file extension
|
- Decompression formats are detected automatically from file extension
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst, cbt, cbz, cb7, cbr
|
||||||
|
@ -7,7 +7,7 @@ expression: "run_ouch(\"ouch decompress b.unknown\", dir)"
|
|||||||
- Decompression formats are detected automatically from file extension
|
- Decompression formats are detected automatically from file extension
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst, cbt, cbz, cb7, cbr
|
||||||
hint:
|
hint:
|
||||||
hint: Alternatively, you can pass an extension to the '--format' flag:
|
hint: Alternatively, you can pass an extension to the '--format' flag:
|
||||||
hint: ouch decompress <TMP_DIR>/b.unknown --format tar.gz
|
hint: ouch decompress <TMP_DIR>/b.unknown --format tar.gz
|
||||||
|
@ -6,7 +6,7 @@ expression: "run_ouch(\"ouch compress input output --format tar.gz.unknown\", di
|
|||||||
- Unsupported extension 'unknown'
|
- Unsupported extension 'unknown'
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst, cbt, cbz, cb7, cbr
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -6,7 +6,7 @@ expression: "run_ouch(\"ouch compress input output --format targz\", dir)"
|
|||||||
- Unsupported extension 'targz'
|
- Unsupported extension 'targz'
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst, cbt, cbz, cb7, cbr
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -6,7 +6,7 @@ expression: "run_ouch(\"ouch compress input output --format .tar.$#!@.rest\", di
|
|||||||
- Unsupported extension '$#!@'
|
- Unsupported extension '$#!@'
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst, cbt, cbz, cb7, cbr
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user