OSDN Git Service

[update] : Supported installed package status
authorhayao <shun819.mail@gmail.com>
Mon, 21 Dec 2020 12:53:18 +0000 (21:53 +0900)
committerhayao <shun819.mail@gmail.com>
Mon, 21 Dec 2020 12:53:18 +0000 (21:53 +0900)
wfa

diff --git a/wfa b/wfa
index a96e013..c97825c 100755 (executable)
--- a/wfa
+++ b/wfa
@@ -939,9 +939,10 @@ search_aur_package() {
 
     local _found_pkgname=($(echo "${_aur_json}" | jq -r ".Name" ))
 
-    local  _found_package __pkgver __popularity __vote __pkgdesc __orphaned
+    local  _found_package __pkgver __popularity __vote __pkgdesc __orphaned __installed
     for _found_package in ${_found_pkgname[@]}; do
         __orphaned=false
+        __installed=false
         _found_json="$(echo ${_aur_json} | jq "select(.Name == \"${_found_package}\")")"
 
         #echo "${_found_json}"
@@ -955,10 +956,16 @@ search_aur_package() {
         if ! echo "${_found_json}" | jq -r --exit-status ".Maintainer"; then
             __orphaned=true
         fi
+
+        # インストール済み判定
+        if check_installed_package "${_found_package}"; then
+            __installed=true
+        fi
+
     
-        echo "$(text -c blue -b "aur")/$(text -b "${_found_package}") $(text -c cyan "${__pkgver}") (+$(text -b ${__vote} ${__popularity})) $(if [[ "${__orphaned}" = true ]]; then text -bc red "(Orphaned)"; fi)"
+        echo "$(text -c blue -b "aur")/$(text -b "${_found_package}") $(text -c cyan "${__pkgver}") (+$(text -b ${__vote} ${__popularity})) $(if [[ "${__orphaned}" = true ]]; then text -bc red "(Orphaned)"; fi) $(if [[ "${__installed}" = true ]]; then text -bc cyan "(Installed)"; fi)"
         echo "    ${__pkgdesc}"
-        unset __pkgver __popularity __vote __pkgdesc _found_json __orphaned
+        unset __pkgver __popularity __vote __pkgdesc _found_json __orphaned __installed
     done
 }