diff --git a/src/checkupdates.sh.in b/src/checkupdates.sh.in
index 0885983..024243c 100644
--- a/src/checkupdates.sh.in
+++ b/src/checkupdates.sh.in
@@ -22,6 +22,7 @@ declare -r myname='checkupdates'
declare -r myver='@PACKAGE_VERSION@'
DOWNLOAD_CACHE=0
+QUIET=0
m4_include(../lib/output_format.sh)
m4_include(../lib/term_colors.sh)
@@ -38,14 +39,15 @@ Usage: ${myname} [options]
Options:
-d, --download download pending updates to the pacman cache.
-h, --help display this help message and exit.
+ -q, --quiet only display pkgnames.
Note: Export the "CHECKUPDATES_DB" variable to change the path of the temporary database.
__EOF__
}
-OPT_SHORT='dh'
-OPT_LONG=('download' 'help')
+OPT_SHORT='dhq'
+OPT_LONG=('download' 'help' 'quiet')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1
@@ -60,6 +62,8 @@ while :; do
-h|--help)
usage
exit 0 ;;
+ -q|--quiet)
+ QUIET=1 ;;
--)
shift
break ;;
@@ -92,6 +96,9 @@ fi
mapfile -t updates < <(pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]')
if (( ${#updates[@]} )); then
+ if (( $QUIET )); then
+ updates=("${updates[@]%% *}")
+ fi
printf '%s\n' "${updates[@]}"
if (( DOWNLOAD_CACHE )); then
sudo pacman -Sw --noconfirm "${updates[@]%% *}" --dbpath "$CHECKUPDATES_DB" --logfile /dev/null
--
2.22.0