Itai-Nelken / aptpac

A simple wrapper for 'pacman' with a syntax similar to 'apt' to help people transitioning to Arch and Arch based distributions like Manjaro.
https://itai-nelken.github.io/aptpac/
MIT License
27 stars 5 forks source link

Handle empty autoremove properly #29

Closed saeziae closed 1 year ago

saeziae commented 1 year ago

When there is not unneeded dependencies to remove, we will encounter:

$ aptpac autoremove
error: argument '-' specified with empty stdin

It looks weird and abrupt.

I modified it so that it can detect if there is a need to run pacman -R:

Test

If there is something to remove, it works as it did in the past:

$ aptpac autoremove                            
checking dependencies...

Packages (2) qoauth-2.0.0-3  qt5-xmlpatterns-5.15.6+kde+r0-1

Total Removed Size:  6.77 MiB

:: Do you want to remove these packages? [Y/n] 

After the command above, run it again:

$ aptpac autoremove
Nothing to be autoremoved.

There will be a friendly prompt.

Itai-Nelken commented 1 year ago

@saeziae could you take please a look at my review so I can merge?

Itai-Nelken commented 1 year ago

Thanks!