Repository navigation
feat: aligned version output and full shell completion - #19
Merged
Merged
Conversation
version prints one line (name, version, tag, commit, build date, OT Fabric libraries, Go version, platform); version --json and OCPPCTL_FORMAT=json print it as one JSON object. Build metadata is resolved in internal/buildinfo, falling back to the toolchain's build info. Every flag that takes a value now completes: fixed values, files of their type, or no file names; commands without argument completion complete no file names. A tree walk test enforces it. The Makefile injects the version and tag only on an exact tag, and the full commit SHA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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, the format shared by every OT Fabric CLI:<name> <version> (tag <tag>, commit <sha>, built <date>, <otfabric libs>, <go>, <os>/<arch>). The tag part is left out when there is no tag. Without injected metadata, the version comes from the module version of a release (go install …@vX.Y.Z) or isdev(pseudo-versions and+dirtycount asdev), and the commit comes fromvcs.revision, with-dirtyadded when the tree was modified.version --json(new) andOCPPCTL_FORMAT=jsonprint one JSON line with the keysname, version, tag, commit, built, libraries, go, platform. The new key set is documented in docs/json-output.md.internal/buildinfo, which replaces the inline version code in cmd/root.go.<Action>ofclient call/client send/server call/validateand forframe encode --action(actions of--ocpp-versionthat the command can send; every version when the flag is not set), forframe encode --error-code(the CALLERROR codes of the version), and for.yaml/.ymlscenarios ofclient script. Newcli.CompleteRestcovers every other flag that takes a value: file flags (--configyaml/yml/json, TLS/PEM files, input/output/password files) complete files of their type, and addresses, numbers and names complete no file names. Commands without argument completion also complete no file names.VERSION/TAGare injected only when HEAD is exactly on a tag (any other build reportsdev), the version has no leadingv, andCOMMITis the full SHA. The release workflow ldflags were already correct and are unchanged.Before / after
Before:
After (real output, local build with release ldflags):
Tests
make check(fmt, staticcheck, golangci-lint, vet, govulncheck, race tests, coverage, per-package floor, docsync) passes, Total coverage: 95.6% (minimum 85%).make e2epasses.+dirty), JSON key order, libraries with zero, one and two entries, and libraries read from build info. cmd: the version line,--jsonandOCPPCTL_FORMAT.__complete: the four shells, one enum flag per command group, and file and free-value flags.TestEveryFlagCompleteswalks the tree and fails on any value flag without completion, and on any flag whose usage lists values but completes none.🤖 Generated with Claude Code