Lymphatus / caesium-clt

Caesium Command Line Tools - Lossy/lossless image compression tool
http://saerasoft.com/caesium
Other
357 stars 34 forks source link

Allow "same folder as input" flag for output #74

Open stamminator opened 1 month ago

stamminator commented 1 month ago

The Caesium GUI app has the option to output to the same folder as the file's input, resulting in an overwrite of the original file. Currently, the only way I can figure out how to do this in caesium-clt is to manually specify the same path via the --output param.

$ caesium -q 0 --output $env:USERPROFILE\screenshots $env:USERPROFILE\screenshots\test.png

Could this flag be added to the CLI as well? Maybe -s, --same-folder-as-input would work. I plan to use it to automatically compress my ShareX screenshots using a custom post-capture action.

Lymphatus commented 1 month ago

A few comments about this:

What do you think?

stamminator commented 1 month ago

I think it must come with a warning saying you are about to overwrite the original files to avoid accidents

Makes sense, although a force flag would be nice for automated workflows.

a--suffix option (or something that can change the output file name) might be useful if you don't want to overwrite

I can see that being useful, but for my use case, the $output variable in ShareX contains the full path and file name. As long as the path and the file name can only be specified each as separate arguments, this workflow wouldn't work without string parsing trickery.

asins commented 1 month ago

This feature is really necessary, are there any plans to add it?

Lymphatus commented 1 month ago

@asins yes, expect it to ship relatively soon