From 2aa0a2105691912f91c2cf989d1de946a69f7eb6 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Mon, 2 Nov 2026 20:25:35 +0100 Subject: [PATCH] fix(cli): use lowercase version option --- README.md | 2 +- skeptical-updater | 8 ++++---- tests/unit/cli.bats | 10 ++++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e50baaa..2e5bfdd 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ options: none (default: paru, else yay, when installed; other backends ignore it) --no-aur same as --aur-helper=none -h, --help this help - -V, --version print the version + -v, --version print the version ``` Exit status: `0` ok, `1` usage or backend error, `2` aborted (end of input), diff --git a/skeptical-updater b/skeptical-updater index 8f6cda8..571e766 100755 --- a/skeptical-updater +++ b/skeptical-updater @@ -6,7 +6,7 @@ # and zypper: list what would be upgraded, interrogate every package, remember the # ones you trust, then run the native upgrade (with per-run exclusions). # -# Version: 0.3.0 +# Version: 0.3.1 # # Specification: docs/DESIGN.md. Single file, bash >= 4.3, no runtime dependency # beyond the distro's package manager and coreutils/sed/grep (awk only on the apt @@ -23,7 +23,7 @@ export LC_ALL=C DEBIAN_FRONTEND=noninteractive # never read from or written to a file (no HISTFILE; `history -r`/`-w`/`-a` are never used). unset HISTFILE -readonly SU_VERSION=0.3.0 +readonly SU_VERSION=0.3.1 readonly SU_PROG=skeptical-updater readonly SU_STATE_HEADER='# skeptical-updater trusted packages. Columns: backend package reason added(UTC ISO-8601)' readonly SU_PROMPT_HELP=' upgrade | N? what is it | N?? full info | N- exclude this run | Nx purge now | N+ trust forever' @@ -105,7 +105,7 @@ options: none (default: paru, else yay, when installed; other backends ignore it) --no-aur same as --aur-helper=none -h, --help this help - -V, --version print the version + -v, --version print the version interactive commands (one line, whitespace-separated tokens, N = number in brackets): proceed: run the native upgrade with the current exclusions @@ -199,7 +199,7 @@ parse_args() { usage exit 0 ;; - -V | --version) + -v | --version) printf '%s %s\n' "$SU_PROG" "$SU_VERSION" exit 0 ;; diff --git a/tests/unit/cli.bats b/tests/unit/cli.bats index 7fe98f0..c14efd6 100644 --- a/tests/unit/cli.bats +++ b/tests/unit/cli.bats @@ -24,12 +24,14 @@ setup() { common_setup; } assert_line 'usage: skeptical-updater [options] [command]' } -@test "--version and -V print the version" { +@test "--version and -v print the version" { run skup --version assert_success - assert_output 'skeptical-updater 0.1.0' - run skup -V - assert_output 'skeptical-updater 0.1.0' + assert_output --regexp '^skeptical-updater [0-9]+\.[0-9]+\.[0-9]+(\+(alpha|beta|rc)[.-]?[0-9]+)?$' + local version=$output + run skup -v + assert_success + assert_output "$version" } @test "an unknown option is a usage error (exit 1)" {