rimage icon indicating copy to clipboard operation
rimage copied to clipboard

[Feature]: Improve args input

Open Mikachu2333 opened this issue 1 year ago • 7 comments

Description

This command could run successfully ./_rimage.exe moz 1717128900569_u.jpg -q 90 -s _update

But this can't, because error: unexpected argument '-q' found tip: to pass '-q' as a value, use '-- -q' ./_rimage.exe png 1717128900569_u.jpg -q 90 -s _update

Problem or Motivation

Some of the command would like to use -- -q rather than -q for example, and should be improved.

Expected behavior

Run successfully

Alternatives Considered

It seemed that only moz mode would run without errors.

Anything else?

No response

Mikachu2333 avatar May 31 '24 05:05 Mikachu2333

Check warning on method that used when parsing multiple positional args - https://docs.rs/clap/latest/clap/builder/struct.Arg.html#method.num_args This is a internal behavior of clap cli parsing. Possible ways to fix it:

  • pass every input file with -f flag
  • pass input files after --
  • use value delimiter

SalOne22 avatar Jun 01 '24 11:06 SalOne22

This is a internal behavior of clap cli parsing. Possible ways to fix it:

And this issue is not related to clap cli parsing, but more to clap's way of showing tips. png command doesn't accept --quality as option, so clap panics with this error: error: unexpected argument '-q' found. But for some reason it shows tip that doesn't make sense tip: to pass '-q' as a value, use '-- -q'. One way to fix this is to remove suggestions completely, but I will try find better solution.

UPD: -- -q passes -q as input file

SalOne22 avatar Jun 02 '24 10:06 SalOne22

in dd2fe3e added warning when file is not found, should I also set default log level to warn? This will add additional information to the user about what happened. But warn level also will show warnings like WARN zune_jpeg::decoder > Marker 0xFFED not known

SalOne22 avatar Jun 02 '24 10:06 SalOne22

should I also set default log level to warn?

I think there's no need to do so for normal users.

Mikachu2333 avatar Jun 02 '24 10:06 Mikachu2333

Then we should add to #200 note that if any error is occurred, user need to consult the help menu. Some lossy codecs can accept quality, lossless not.

For reference, lossy codecs - mozjpeg, regular jpeg, avif and webp. Other doesn't have --quality option available.

SalOne22 avatar Jun 04 '24 08:06 SalOne22

Then we should add to #200 note that if any error is occurred, user need to consult the help menu. Some lossy codecs can accept quality, lossless not.

Agree.


Besides, I wonder where would --preserve arg be added into, common.rs also? If not, please note me about the file, and I'll try to improve help info in #200.

And, maybe the help info should note some Key Content that users should pay attention to and should be emphasized.

e.g. jxl Before: Only support lossless output, ... (detailed infomation) After: Only support lossless output, ... (detailed infomation)

Is there a way to implement infos with this display style?

Mikachu2333 avatar Jun 04 '24 12:06 Mikachu2333

Some lossy codecs can accept quality, lossless not.

In my option, just panic!() or give the error info and exit is enough. If users add the -q option for lossless codec.

Mikachu2333 avatar Jun 04 '24 12:06 Mikachu2333