feat(cli): scaffold tpagectl command #535
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!535
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/cli-scaffold"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Initializes the
tpagectlCLI module structure: a newcmd/tpagectl/entrypoint backed by the urfave/cli v3 framework, reusing the existingthwap-pagesdGo module, plus build-time version metadata wired through the Makefile.Why
First task in CLI-ROADMAP.md Phase 1 (Project Setup and CLI Framework). Lays the foundation for the site, deployment, and preview command groups that follow.
Testing
go test -race ./...)go vet ./...,golangci-lint run,go mod verifycleanmake build-tpagectlproduces a working binary;--versionprints build metadatacmd/tpagectl/main_test.go(root command wiring +--versionoutput)Breaking Changes
None.
Screenshots
Notes
git.lan.thwap.org/thwap/thwap-pagesdmodule; CLI and daemon shareerrors/,logging/, and vendored deps.Closes #145
Closes #146
Closes #147
Closes #148
Closes #149
cmd/tpagectl/directory with main.go #145Review
No blocking issues. Verified locally against the PR head (
0e8b57e):go build -mod=vendor ./...,go vet ./..., andgo test -race -count=1 ./cmd/tpagectl/all pass;gofmt -lclean;go mod verifypasses;vendor/modules.txtincludes the newurfave/cli/v3entry.Functional checks:
make build-tpagectlbuildsdist/tpagectl(fresh worktree —go build -o dist/...creates the dir), and-ldflags "-X main.version/commit/date"correctly injects build metadata:tpagectl version dev,commit: 0e8b57e,built: <RFC3339>.tpagectl --versionprints via the customVersionPrinter; no-args prints help and exits 0; an unknown flag printsIncorrect Usageplus the stderrerror:line and exits 1.--versionoutput.Suggestions
cmd/tpagectl/main.go:32—cli.VersionPrinteris set as a global side effect inside thenewCommand()constructor. It's package-global mutable state that later subcommand trees ort.Parallel()tests could clobber. Prefer setting it once inmain(). Filed as #536.Notes (not blocking, not filed)
build-tpagectlis intentionally not part ofall/build; worth wiring intoallonce the CLI gains commands.-X main.versionrelies on the package being namedmain; fine today, just coupling to note if the entrypoint is ever restructured.Praise
version/commit/date, Makefile vars follow the existing style, and the CLI entrypoint keepsmain()trivial.Version: versioninto the command so help renders the version too.Approving.