Repository navigation
feat: aligned version output and full shell completion - #22
Merged
Merged
Conversation
version prints one line, name version (tag, commit, built, go, platform), and version --json (or SUNSPECCTL_FORMAT=json) one JSON line with the keys name, version, tag, commit, built, go, platform. A development build falls back on the Go module version and VCS stamp. Every flag that takes a value now has a completion function: serial enums, URL schemes, model IDs and point names from the go-sunspec registry, JSON and PEM files, no file names for free values. The bash script is cobra's V2. make build stamps the full SHA and a tag only on a tagged commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
version names the github.com/otfabric/go-* modules the binary is built with after the build date, and version --json has a libraries array between built and go. Pseudo-versions and +dirty versions from the build info report dev. make build stamps VERSION and TAG only when HEAD is exactly on a tag; otherwise the binary reports dev. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
versionprints one line:sunspecctl <version> (tag <tag>, commit <sha>, built <date>, <go>, <goos>/<goarch>); the tag part is left out without a tag, the version has no leadingv. A development build reportsdevand takes the commit from the Go VCS stamp (-dirtyfor a modified tree);go install …@vX.Y.Zreports that version. New packageinternal/buildinfo;main.*stays the ldflags target.version --json(the global--json, alsoSUNSPECCTL_FORMAT=json): one JSON line, keysname,version,tag,commit,built,go,platformin this order, always present. Breaking for scripts that read the old object (buildDate→built, indented → one line); noted in RELEASE.md and docs/json-output.md.completioncommand keeps all four shells (bash now uses cobra's V2 script with descriptions). Every flag that takes a value now has a completion function (walk test):--parity,--data-bits,--stop-bits,--baud,--url(schemes),--id/--model(model IDs with a known schema, with labels),--point(point names of the--modelgiven),serve --file(json),--tls-ca/--tls-cert/--tls-key(pem…),--output(any file);--timeout,--interval,--count,--unit-id,--base-addresscomplete no file names. Commands without positional arguments complete no file names.make build:COMMITis the full SHA;TAGuses--exact-match(it used--abbrev=0, which stamped the last tag on any later commit). Release workflow ldflags were already correct.Follow-up commit (brief amendments)
github.com/otfabric/go-*modules of the build info, sorted) followbuilt …in the text line, andlibraries([{"name","version"}],[]when none) sits betweenbuiltandgoin the JSON.+dirtymodule versions reportdev.VERSIONandTAGonly when HEAD is exactly on a tag; otherwise empty and the binary reportsdev.Before / after
Before (v0.5.1 built with release-style ldflags):
After (release-style ldflags):
Plain
go build(a clean checkout off a tag):Tests run
make check(fmt-check, vet, lint, vuln, race tests, coverage 99.0%),make e2eversion,version --json,SUNSPECCTL_FORMAT=json version,completion bash|zsh|fish|powershell,__complete completion "",__complete read-point --model 103 --point "",__complete detect --parity ""🤖 Generated with Claude Code