From f580a59be05fc9fbed0d7e5c7a78e464f357d58a Mon Sep 17 00:00:00 2001 From: Digital Studium Date: Sun, 26 May 2024 10:50:57 +0300 Subject: [PATCH] Separate Install/Remove for apt --- src/a | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/a b/src/a index 387ab66..4e60a14 100755 --- a/src/a +++ b/src/a @@ -8,8 +8,11 @@ EOL action=$(DIALOGRC=/tmp/.dialogrc dialog --stdout --erase-on-exit --menu "Choose the action for apt" 10 40 0 "Install" 1 "Install from .deb file" 2 "Update" 3 "Upgrade" 4 "Remove" 5 "Autoremove" 6) -if [[ $action == "Install" || $action == "Remove" ]]; then - package=$(apt-cache search '' | sort | cut --delimiter ' ' --fields 1 | fzf --multi --cycle --reverse --preview 'apt-cache show {1}') +if [[ $action == "Install" ]]; then + package=$(apt list -qq 2>/dev/null | grep -v installed | cut --delimiter '/' --fields 1 | fzf --multi --cycle --reverse --preview 'apt show 2>/dev/null {1}') + sudo apt ${action,,} $package -y +elif [[ $action == "Remove" ]]; then + package=$(apt list -qq --installed 2>/dev/null | cut --delimiter '/' --fields 1 | fzf --multi --cycle --reverse --preview 'apt show 2>/dev/null {1}') sudo apt ${action,,} $package -y elif [[ $action == "Install from .deb file" ]]; then find . -name "*.deb" | fzf | xargs -I _ sudo apt install -y _