Nukesor / pueue

:stars: Manage your shell commands.
MIT License
4.69k stars 128 forks source link

[feat]: 'pueue clean success' to clean successful tasks only and keep failed tasks #483

Closed tnsardesai closed 6 months ago

tnsardesai commented 6 months ago

A detailed description of the feature you would like to see added.

Today pueue clean cleans all finished tasks. I would like to see a new optional argument to clean tasks with Success status only. Specifically what I would like to see is that this command should not remove tasks with status Failed

pueue clean success to clean successful tasks only pueue clean to clean all tasks (default behavior)

Explain your usecase of the requested feature

I run watch -c 'unbuffer pueue status' in a terminal window for a nice dashboard to monitor my tasks. I occasionally run pueue clean to remove finished tasks. But everytime I run pueue clean I have to first check if any of the finished tasks failed or not. I would like to not worry about that and just run pueue clean success which cleans up the uninteresting case (successful tasks) and keep the interesting case (failed tasks). This way at the end I can loop through the output and perform whatever actions I want against the failed tasks

Alternatives

Currently I just grep the output, make a note of what failed and why and then run pueue clean. I have to be careful that between my grep and the clean nothing else fails. Another way I could do this is grep for success and get the task ids and then call pueue remove on those task ids.

Additional context

No response

Nukesor commented 6 months ago

Please take a look at the help output of pueue clean

Nukesor commented 6 months ago

pueue clean -h in case you didn't know that there're help pages for subcommands.

tnsardesai commented 6 months ago

I didn't realize that there are help pages for subcommands! pueue clean --successful-only solves my problem so I am gonna close this issue šŸ‘