alucryd / oxyromon

Rusty ROM OrgaNizer
Other
110 stars 13 forks source link

Can't capture output as stdout/stderr #99

Open bhartshorn opened 9 months ago

bhartshorn commented 9 months ago

Hello again,

This issue could be solved a couple ways: mostly I'm trying to import some large number of files and clear (delete) them if they are already imported. oxyromon currently prints "Already imported" to the terminal and does basically nothing. I hoped the -f flag would re-import and delete the file, but that's not the behavior I'm seeing. Second attempt was to capture the stdout/stderr of oxyromon and just search the output, and delete the file if it's already been imported. But capturing the output returns nothing, it seems because the output is all done through the indicatif progressbar library, which the docs state:

if a non terminal is detected the progress bar will be completely hidden. This makes piping programs to logfiles make sense out of the box.

So this is intended behavior, but makes it very hard to use oxyromon in a script. So, can I request either some more options around importing (i.e. deleting the file if it's already imported), or to use some other method of outputting status so that it's useful in a scripting context?

Thanks!

alucryd commented 9 months ago

Actually it sounds the -t flag should already achieve what you want. I need to update the doc to explain it trashes invalid and duplicate ROMs. As for -f it was the intended behavior to replace an existing ROM, so that's probably a bug. Is it easily reproducible?