From b0059ada8b5311f8fc5dba86df42e54e8d16ffa2 Mon Sep 17 00:00:00 2001 From: Guy J Grigsby Date: Fri, 16 Oct 2026 16:10:21 +0000 Subject: [PATCH] release: print the installed version in the GNU flag form install.sh called the binary it had just installed as `aperture -version`. gnuForm rewrites that single-dash long form and warns on stderr, so every fresh install ended on a deprecation notice about a flag the user never typed. `--version` works on every release install.sh can install. Pre-0.1.0 binaries parsed flags with the standard library's flag package, which treats one and two leading dashes alike. A scripts test holds the GNU form because no Go test sees the installer's output. --- install.sh | 2 +- scripts/sign_macos_test.go | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index b687c1d..83b92e5 100755 --- a/install.sh +++ b/install.sh @@ -81,4 +81,4 @@ fi $sudo mkdir -p "$INSTALL_DIR" $sudo install -m 0755 "$bin" "$INSTALL_DIR/aperture" -echo "==> Installed $("$INSTALL_DIR/aperture" -version | head -1) to $INSTALL_DIR/aperture" +echo "==> Installed $("$INSTALL_DIR/aperture" --version | head -1) to $INSTALL_DIR/aperture" diff --git a/scripts/sign_macos_test.go b/scripts/sign_macos_test.go index 845b27b..9426da0 100644 --- a/scripts/sign_macos_test.go +++ b/scripts/sign_macos_test.go @@ -176,3 +176,20 @@ case "$tool $1" in ;; esac ` + +// install.sh reports the version of what it just installed. It has to use the +// GNU form: the single-dash long form is deprecated, so it both prints a +// deprecation warning on stderr and would greet every fresh install with a +// notice about a flag the user never typed. +func TestInstallScriptReportsVersionInGNUForm(t *testing.T) { + script, err := os.ReadFile("../install.sh") + if err != nil { + t.Fatal(err) + } + if strings.Contains(string(script), " -version") { + t.Error("install.sh calls the installed binary with the deprecated -version form") + } + if !strings.Contains(string(script), `aperture" --version`) { + t.Error("install.sh no longer reports the installed version") + } +}