From 615f49143340f60e8c3a1795353a9c24e07e0701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Thu, 28 Mar 2024 10:45:24 +0100 Subject: [PATCH] Simplify get_pkgmgr() subroutine. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently it only is configured to deal with pacman or yay (as noted in the comment). Other AUR helpers would need to be configured. Signed-off-by: Nicolás Ortega Froysa --- pacundo.pl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pacundo.pl b/pacundo.pl index 8adeb19..fc90c52 100755 --- a/pacundo.pl +++ b/pacundo.pl @@ -137,6 +137,8 @@ $n, $tx->{action}, $tx->{pkg_name} return @sel_undo; } +# NOTE: Currently this subroutine only works for pacman and yay. You'll have to +# add options for additional AUR helpers. sub get_pkgmgr() { my $mgr = $ENV{DEFAULT_PKGMGR} // 'pacman'; my $mgr_bin = `which $mgr 2>&1`; @@ -146,18 +148,13 @@ sub get_pkgmgr() { exit 1; } - my $mgr_cmd_search = "$mgr_bin -Ss"; - my $mgr_cmd_install_remote = "$mgr_bin -S"; - my $mgr_cmd_install_local = "$mgr_bin -U"; - my $mgr_cmd_remove = "$mgr_bin -R"; - my %pkgmgr = ( name => $mgr, bin => $mgr_bin, - search => $mgr_cmd_search, - install_remote => $mgr_cmd_install_remote, - install_local => $mgr_cmd_install_local, - remove => $mgr_cmd_remove, + search => "$mgr_bin -Ss", + install_remote => "$mgr_bin -S", + install_local => "$mgr_bin -U", + remove => "$mgr_bin -R", ); return \%pkgmgr;