mirror of
https://github.com/ouch-org/ouch.git
synced 2025-07-19 16:10:53 +00:00
fix: fix and update tests and docs
This commit is contained in:
parent
2216764e1d
commit
cd104a2377
11
README.md
11
README.md
@ -111,9 +111,9 @@ Output:
|
|||||||
|
|
||||||
# Supported formats
|
# Supported formats
|
||||||
|
|
||||||
| Format | `.tar` | `.zip` | `7z` | `.gz` | `.xz`, `.lzma` | `.bz`, `.bz2` | `.bz3` | `.lz4` | `.sz` (Snappy) | `.zst` | `.rar` | `.br` |
|
| Format | `.tar` | `.zip` | `7z` | `.gz` | `.xz` | `.lzma` | `.lz` | `.bz`, `.bz2` | `.bz3` | `.lz4` | `.sz` (Snappy) | `.zst` | `.rar` | `.br` |
|
||||||
|:---------:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
|:---------:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||||
| Supported | ✓ | ✓¹ | ✓¹ | ✓² | ✓ | ✓ | ✓ | ✓ | ✓² | ✓² | ✓³ | ✓ |
|
| Supported | ✓ | ✓¹ | ✓¹ | ✓² | ✓ | ✓⁴ | ✓⁴ | ✓ | ✓ | ✓ | ✓² | ✓² | ✓³ | ✓ |
|
||||||
|
|
||||||
✓: Supports compression and decompression.
|
✓: Supports compression and decompression.
|
||||||
|
|
||||||
@ -122,10 +122,13 @@ Output:
|
|||||||
✓²: Supported, and compression runs in parallel.
|
✓²: Supported, and compression runs in parallel.
|
||||||
|
|
||||||
✓³: Due to RAR's restrictive license, only decompression and listing can be supported.
|
✓³: Due to RAR's restrictive license, only decompression and listing can be supported.
|
||||||
|
|
||||||
|
✓⁴: Only decompression is supported, compression is not implemented yet.
|
||||||
|
|
||||||
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`.
|
`tar` aliases are also supported: `tgz`, `tbz`, `tbz2`, `tlz4`, `txz`, `tlzma`, `tsz`, `tzst`, `tlz`.
|
||||||
|
|
||||||
Formats can be chained:
|
Formats can be chained:
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use clap::{Parser, ValueHint};
|
|||||||
// Ouch command line options (docstrings below are part of --help)
|
// Ouch command line options (docstrings below are part of --help)
|
||||||
/// A command-line utility for easily compressing and decompressing files and directories.
|
/// A command-line utility for easily compressing and decompressing files and directories.
|
||||||
///
|
///
|
||||||
/// Supported formats: tar, zip, gz, 7z, xz/lzma, bz/bz2, bz3, lz4, sz (Snappy), zst, rar and br.
|
/// Supported formats: tar, zip, gz, 7z, xz, lzma, lzip, bz/bz2, bz3, lz4, sz (Snappy), zst, rar and br.
|
||||||
///
|
///
|
||||||
/// Repository: https://github.com/ouch-org/ouch
|
/// Repository: https://github.com/ouch-org/ouch
|
||||||
#[derive(Parser, Debug, PartialEq)]
|
#[derive(Parser, Debug, PartialEq)]
|
||||||
|
@ -135,8 +135,8 @@ impl FinalError {
|
|||||||
///
|
///
|
||||||
/// This is what it looks like:
|
/// This is what it looks like:
|
||||||
/// ```
|
/// ```
|
||||||
/// hint: Supported extensions are: tar, zip, bz, bz2, gz, lz4, xz, lzma, sz, zst
|
/// hint: Supported extensions are: tar, zip, bz, bz2, gz, lz4, xz, lzma, lz, sz, zst
|
||||||
/// hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
/// hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
/// ```
|
/// ```
|
||||||
pub fn hint_all_supported_formats(self) -> Self {
|
pub fn hint_all_supported_formats(self) -> Self {
|
||||||
self.hint(format!("Supported extensions are: {}", PRETTY_SUPPORTED_EXTENSIONS))
|
self.hint(format!("Supported extensions are: {}", PRETTY_SUPPORTED_EXTENSIONS))
|
||||||
|
@ -19,6 +19,7 @@ pub const SUPPORTED_EXTENSIONS: &[&str] = &[
|
|||||||
"lz4",
|
"lz4",
|
||||||
"xz",
|
"xz",
|
||||||
"lzma",
|
"lzma",
|
||||||
|
"lz",
|
||||||
"sz",
|
"sz",
|
||||||
"zst",
|
"zst",
|
||||||
#[cfg(feature = "unrar")]
|
#[cfg(feature = "unrar")]
|
||||||
@ -27,14 +28,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", "tlzma", "tsz", "tzst", "tlz"];
|
||||||
|
|
||||||
#[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, lz, 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, lz, 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, tlzma, tsz, tzst, tlz";
|
||||||
|
|
||||||
/// A wrapper around `CompressionFormat` that allows combinations like `tgz`
|
/// A wrapper around `CompressionFormat` that allows combinations like `tgz`
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -33,7 +33,6 @@ enum DirectoryExtension {
|
|||||||
Tbz3,
|
Tbz3,
|
||||||
Tgz,
|
Tgz,
|
||||||
Tlz4,
|
Tlz4,
|
||||||
Tlzma,
|
|
||||||
Tsz,
|
Tsz,
|
||||||
Txz,
|
Txz,
|
||||||
Tzst,
|
Tzst,
|
||||||
@ -50,7 +49,6 @@ enum FileExtension {
|
|||||||
Bz3,
|
Bz3,
|
||||||
Gz,
|
Gz,
|
||||||
Lz4,
|
Lz4,
|
||||||
Lzma,
|
|
||||||
Sz,
|
Sz,
|
||||||
Xz,
|
Xz,
|
||||||
Zst,
|
Zst,
|
||||||
|
@ -17,7 +17,7 @@ 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", "tar", "zip", "tar.gz", "tgz", "tbz", "tbz2", "txz", "tzst", "tar.bz", "tar.bz2",
|
||||||
"tar.xz", "tar.zst",
|
"tar.xz", "tar.zst",
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -30,12 +30,10 @@ fn sanity_check_through_mime() {
|
|||||||
"application/x-bzip2",
|
"application/x-bzip2",
|
||||||
"application/x-bzip2",
|
"application/x-bzip2",
|
||||||
"application/x-xz",
|
"application/x-xz",
|
||||||
"application/x-xz",
|
|
||||||
"application/zstd",
|
"application/zstd",
|
||||||
"application/x-bzip2",
|
"application/x-bzip2",
|
||||||
"application/x-bzip2",
|
"application/x-bzip2",
|
||||||
"application/x-xz",
|
"application/x-xz",
|
||||||
"application/x-xz",
|
|
||||||
"application/zstd",
|
"application/zstd",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ expression: "run_ouch(\"ouch decompress a\", dir)"
|
|||||||
- Files with missing extensions: <TMP_DIR>/a
|
- Files with missing extensions: <TMP_DIR>/a
|
||||||
- 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, lz, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
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
|
||||||
|
@ -7,5 +7,5 @@ expression: "run_ouch(\"ouch decompress a b.unknown\", dir)"
|
|||||||
- Files with missing extensions: <TMP_DIR>/a
|
- Files with missing extensions: <TMP_DIR>/a
|
||||||
- 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, lz, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
|
@ -6,8 +6,8 @@ expression: "run_ouch(\"ouch decompress b.unknown\", dir)"
|
|||||||
- Files with unsupported extensions: <TMP_DIR>/b.unknown
|
- Files with unsupported extensions: <TMP_DIR>/b.unknown
|
||||||
- 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, lz, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
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,8 +6,8 @@ expression: "run_ouch(\"ouch decompress a\", dir)"
|
|||||||
- Files with missing extensions: <TMP_DIR>/a
|
- Files with missing extensions: <TMP_DIR>/a
|
||||||
- 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, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, lz, sz, zst, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
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
|
||||||
|
@ -7,5 +7,5 @@ expression: "run_ouch(\"ouch decompress a b.unknown\", dir)"
|
|||||||
- Files with missing extensions: <TMP_DIR>/a
|
- Files with missing extensions: <TMP_DIR>/a
|
||||||
- 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, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, lz, sz, zst, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
|
@ -6,8 +6,8 @@ expression: "run_ouch(\"ouch decompress b.unknown\", dir)"
|
|||||||
- Files with unsupported extensions: <TMP_DIR>/b.unknown
|
- Files with unsupported extensions: <TMP_DIR>/b.unknown
|
||||||
- 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, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, lz, sz, zst, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
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
|
||||||
|
@ -5,8 +5,8 @@ expression: "run_ouch(\"ouch compress input output --format tar.gz.unknown\", di
|
|||||||
[ERROR] Failed to parse `--format tar.gz.unknown`
|
[ERROR] Failed to parse `--format tar.gz.unknown`
|
||||||
- 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, lz, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -5,8 +5,8 @@ expression: "run_ouch(\"ouch compress input output --format targz\", dir)"
|
|||||||
[ERROR] Failed to parse `--format targz`
|
[ERROR] Failed to parse `--format targz`
|
||||||
- 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, lz, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -5,8 +5,8 @@ expression: "run_ouch(\"ouch compress input output --format .tar.$#!@.rest\", di
|
|||||||
[ERROR] Failed to parse `--format .tar.$#!@.rest`
|
[ERROR] Failed to parse `--format .tar.$#!@.rest`
|
||||||
- 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, lz, sz, zst, rar, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -5,8 +5,8 @@ expression: "run_ouch(\"ouch compress input output --format tar.gz.unknown\", di
|
|||||||
[ERROR] Failed to parse `--format tar.gz.unknown`
|
[ERROR] Failed to parse `--format tar.gz.unknown`
|
||||||
- Unsupported extension 'unknown'
|
- Unsupported extension 'unknown'
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, lz, sz, zst, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -5,8 +5,8 @@ expression: "run_ouch(\"ouch compress input output --format targz\", dir)"
|
|||||||
[ERROR] Failed to parse `--format targz`
|
[ERROR] Failed to parse `--format targz`
|
||||||
- Unsupported extension 'targz'
|
- Unsupported extension 'targz'
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, lz, sz, zst, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -5,8 +5,8 @@ expression: "run_ouch(\"ouch compress input output --format .tar.$#!@.rest\", di
|
|||||||
[ERROR] Failed to parse `--format .tar.$#!@.rest`
|
[ERROR] Failed to parse `--format .tar.$#!@.rest`
|
||||||
- Unsupported extension '$#!@'
|
- Unsupported extension '$#!@'
|
||||||
|
|
||||||
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, sz, zst, 7z
|
hint: Supported extensions are: tar, zip, bz, bz2, bz3, gz, lz4, xz, lzma, lz, sz, zst, 7z
|
||||||
hint: Supported aliases are: tgz, tbz, tlz4, txz, tzlma, tsz, tzst
|
hint: Supported aliases are: tgz, tbz, tlz4, txz, tlzma, tsz, tzst, tlz
|
||||||
hint:
|
hint:
|
||||||
hint: Examples:
|
hint: Examples:
|
||||||
hint: --format tar
|
hint: --format tar
|
||||||
|
@ -5,7 +5,7 @@ snapshot_kind: text
|
|||||||
---
|
---
|
||||||
A command-line utility for easily compressing and decompressing files and directories.
|
A command-line utility for easily compressing and decompressing files and directories.
|
||||||
|
|
||||||
Supported formats: tar, zip, gz, 7z, xz/lzma, bz/bz2, bz3, lz4, sz (Snappy), zst, rar and br.
|
Supported formats: tar, zip, gz, 7z, xz, lzma, lzip, bz/bz2, bz3, lz4, sz (Snappy), zst, rar and br.
|
||||||
|
|
||||||
Repository: https://github.com/ouch-org/ouch
|
Repository: https://github.com/ouch-org/ouch
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user