Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/version/check.sh25
-rw-r--r--src/lib/version/upgrade.sh21
2 files changed, 42 insertions, 4 deletions
diff --git a/src/lib/version/check.sh b/src/lib/version/check.sh
index fba2d1a..9bc29c1 100644
--- a/src/lib/version/check.sh
+++ b/src/lib/version/check.sh
@@ -29,7 +29,8 @@ pkgctl_version_check_usage() {
will be supplied from \${XDG_CONFIG_HOME}/nvchecker.
OPTIONS
- -h, --help Show this help text
+ -v, --verbose Display results including up-to-date versions
+ -h, --help Show this help text
EXAMPLES
$ ${COMMAND} neovim vim
@@ -37,9 +38,10 @@ _EOF_
}
pkgctl_version_check() {
- local path
local pkgbases=()
- local status_file path pkgbase upstream_version result
+ local verbose=0
+
+ local path status_file path pkgbase upstream_version result
local up_to_date=()
local out_of_date=()
@@ -53,6 +55,10 @@ pkgctl_version_check() {
pkgctl_version_check_usage
exit 0
;;
+ -v|--verbose)
+ verbose=1
+ shift
+ ;;
--)
shift
break
@@ -81,6 +87,11 @@ pkgctl_version_check() {
fi
fi
+ # enable verbose mode when we only have a single item to check
+ if (( ${#pkgbases[@]} == 1 )); then
+ verbose=1
+ fi
+
# start a terminal spinner as checking versions takes time
status_dir=$(mktemp --tmpdir="${WORKDIR}" --directory pkgctl-version-check-spinner.XXXXXXXXXX)
term_spinner_start "${status_dir}"
@@ -140,6 +151,14 @@ pkgctl_version_check() {
# stop the terminal spinner after all checks
term_spinner_stop "${status_dir}"
+ if (( verbose )) && (( ${#up_to_date[@]} > 0 )); then
+ printf "%sUp-to-date%s\n" "${section_separator}${BOLD}${UNDERLINE}" "${ALL_OFF}"
+ section_separator=$'\n'
+ for result in "${up_to_date[@]}"; do
+ msg_success " ${result}"
+ done
+ fi
+
if (( ${#failure[@]} > 0 )); then
printf "%sFailure%s\n" "${section_separator}${BOLD}${UNDERLINE}" "${ALL_OFF}"
section_separator=$'\n'
diff --git a/src/lib/version/upgrade.sh b/src/lib/version/upgrade.sh
index 9f884d0..70513ce 100644
--- a/src/lib/version/upgrade.sh
+++ b/src/lib/version/upgrade.sh
@@ -32,7 +32,8 @@ pkgctl_version_upgrade_usage() {
The current working directory is used if no PKGBASE is specified.
OPTIONS
- -h, --help Show this help text
+ -v, --verbose Display results including up-to-date versions
+ -h, --help Show this help text
EXAMPLES
$ ${COMMAND} neovim vim
@@ -42,6 +43,7 @@ _EOF_
pkgctl_version_upgrade() {
local path upstream_version result
local pkgbases=()
+ local verbose=0
local exit_code=0
local current_item=0
@@ -51,6 +53,10 @@ pkgctl_version_upgrade() {
pkgctl_version_upgrade_usage
exit 0
;;
+ -v|--verbose)
+ verbose=1
+ shift
+ ;;
--)
shift
break
@@ -79,6 +85,11 @@ pkgctl_version_upgrade() {
fi
fi
+ # enable verbose mode when we only have a single item to check
+ if (( ${#pkgbases[@]} == 1 )); then
+ verbose=1
+ fi
+
# start a terminal spinner as checking versions takes time
status_dir=$(mktemp --tmpdir="${WORKDIR}" --directory pkgctl-version-check-spinner.XXXXXXXXXX)
term_spinner_start "${status_dir}"
@@ -142,6 +153,14 @@ pkgctl_version_upgrade() {
# stop the terminal spinner after all checks
term_spinner_stop "${status_dir}"
+ if (( verbose )) && (( ${#up_to_date[@]} > 0 )); then
+ printf "%sUp-to-date%s\n" "${section_separator}${BOLD}${UNDERLINE}" "${ALL_OFF}"
+ section_separator=$'\n'
+ for result in "${up_to_date[@]}"; do
+ msg_success " ${result}"
+ done
+ fi
+
if (( ${#failure[@]} > 0 )); then
exit_code=1
printf "%sFailure%s\n" "${section_separator}${BOLD}${UNDERLINE}" "${ALL_OFF}"