Skip to content

fix: accept --version and -version as a global flag - #15

Merged
groupsky merged 1 commit into
mainfrom
fix/version-flag
Nov 16, 2026
Merged

groupsky merged 1 commit into
mainfrom
fix/version-flag

Conversation

@groupsky

Copy link
Copy Markdown
Contributor

Fixes #14.

pullgate --version failed in v0.1.0 with "flag provided but not defined". Now:

  • pullgate --version and pullgate -version print pullgate X.Y.Z on stdout and exit 0, also after other global flags (pullgate --config-dir /x --version). They return before any config, state or spool is read.
  • pullgate version works as before. install.sh still uses it, so nothing changes there.
  • pullgate --help lists --version. The README names both forms.
  • --version is a global flag only. After a command (pullgate run NAME --version) it is still an unknown argument, exit 64.

Tests in cmd/pullgate/main_test.go:

  • TestVersionForms: version, --version, -version, --config-dir /x --version, all global flags then -version, and --version run example (prints the version, reads no config).
  • TestVersionDeny: --version=maybe, --versions, --config-dir --version (no command), --version after run, status and listen, and --version=false all exit 64 with no stdout.
  • TestHelpListsVersion: --help and -h list --version and version.

Reviews: the security reviewer found no critical, high or medium findings. One low wording point (a dev build prints pullgate dev) is fixed in the README. The correctness review found no bugs. Its two small points (a test for the flag after a command, and the README placement) are fixed. DESIGN.md and THREAT-MODEL.md need no change: no message, check, user or file changes.

🤖 Generated with Claude Code

`pullgate --version` failed with "flag provided but not defined". It now
prints the same line as `pullgate version` and exits 0, also after other
global flags. `--help` and the README name both forms.

Fixes #14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@groupsky
groupsky merged commit 5450bbc into main Nov 16, 2026
8 checks passed
@groupsky
groupsky deleted the fix/version-flag branch November 16, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: pullgate --version fails with "flag provided but not defined"

1 participant