Skip to content

Improve error message description when trying to compress a folder with a multiple single file formats #268

@marcospb19

Description

@marcospb19

Version

e377dd3 (latest)

Description

Ouch is not giving a correct error message when trying to compress a folder with multiple single formats:

$ ouch compress linux.pkg linux.xz.gz.zst

Current Behavior

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/commands/mod.rs:102:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected Behavior

Something like this, when we just pass ".xz".

$ ouch compress linux-5.17.5.arch1-1-x86_64.pkg linux.xz
[ERROR] Cannot compress to 'linux.xz'.
 - You are trying to compress multiple files.
 - The compression format 'xz' cannot receive multiple files.
 - The only supported formats that archive files into an archive are .tar and .zip.

hint: Try inserting '.tar' or '.zip' before 'xz'.
hint: From: linux.xz
hint: To:   linux.tar.xz

Additional Information

It would be beneficial, while solving this, to write integration tests that check what is the output given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions