From e3edf25554c78e28679b100e24c55c87ee65a22d Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 18 Jan 2024 19:15:22 +0100 Subject: feat(version): use exit code for check to indicate out-of-date versions It can be handy to have an exit code that allows better status indication or chaining. On exit, return one of the following codes: - 0: Normal exit condition, all checked versions are up-to-date - 1: Unknown cause of failure - 2: Normal exit condition, but there are out-of-date versions - 3: Failed to run some version checks Component: pkgctl version check Signed-off-by: Levente Polyak --- src/lib/version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/version.sh') diff --git a/src/lib/version.sh b/src/lib/version.sh index 14cd810..4340fca 100644 --- a/src/lib/version.sh +++ b/src/lib/version.sh @@ -47,7 +47,7 @@ pkgctl_version() { # shellcheck source=src/lib/version/check.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/version/check.sh pkgctl_version_check "$@" - exit 0 + exit $? ;; upgrade) _DEVTOOLS_COMMAND+=" $1" @@ -55,7 +55,7 @@ pkgctl_version() { # shellcheck source=src/lib/version/upgrade.sh source "${_DEVTOOLS_LIBRARY_DIR}"/lib/version/upgrade.sh pkgctl_version_upgrade "$@" - exit 0 + exit $? ;; *) die "invalid argument: %s" "$1" -- cgit v1.2.3-54-g00ecf