ouch icon indicating copy to clipboard operation
ouch copied to clipboard

Compression error hints can make wrong suggestions

Open marcospb19 opened this issue 4 years ago • 0 comments

Originally posted by @dcariotti in https://github.com/ouch-org/ouch/pull/84#discussion_r726548754

Problem

After running this:

ouch c 1.txt 2.txt archive.lz.tar

Ouch shows an error message:

[ERROR] Cannot compress to 'archive.lz.tar'.
 - You are trying to compress multiple files.
 - The compression format '.lz' 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 '.lz'.
hint: From: archive.lz.tar
hint:  To : archive.tar.lz.tar

However, if you follow what the hints suggest and use archive.tar.lz.tar:

ouch c 1.txt 2.txt archive.tar.lz.tar

You will receive the following error:

 - Found the format '.tar' in an incorrect position.
 - '.tar' can only be used at the start of the file extension.

hint: If you wish to compress multiple files, start the extension with '.tar'.
hint: Otherwise, remove '.tar' from 'archive.tar.lz.tar'.

Our hints are not ready for this specific errors.

Maybe it probably should just have said "you might want to move .tar to the start".

There are actually a lot of ways we can rethink those error messages to fix this issue, I'm not currently sure what's the best one.

marcospb19 avatar Oct 14 '21 20:10 marcospb19