Skip to content

Add --format flag #134

@marcospb19

Description

@marcospb19

Problem

Currently, we don't have control of what extensions should be used in compression or decompression, we rely on automatic extension detection.

Using archive.tar.gz.xz as an example, you might want to decompress it into:

archive.tar.gz, without the .xz part, or
archive.tar, without the .gz.xz part.

That is, decompress it partially, or just decompress a file without extensions.

Workaround

Decompress and compress it again.

ouch decompress archive.tar.gz.xz -o result
cd result
ouch compress * .* archive.tar 

Note that the shell expansion .* is necessary in case you have any hidden files.

New solution

--format flag that overwrites the automatic format detection system.

ouch compress file.tar file.tar.xz --format xz
ouch decompress secret_file --format tar.gz

We already have detection on partial compression:

ouch compress file.tar file.tar.xz

Ouch detects it should only partially compress the .xz part, and triggers it, I think this behavior is useful but can be triggered by accident.

We should leave this detection only as a warning to tell the users that if they want to partially compress, they should use the --format flag.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions