check / check (push) Successful in 1m40s
`cmd/simplexcalc/` now holds only `main.go`, whose body is one call, `os.Exit(cli.Main(version))`, as the Go style guide requires. The command tree and the `run` and `version` commands moved unchanged into `internal/cli`, with tests for `version` and for an unknown command. Output streams, exit statuses and the `-X main.version` build flag are as before. Disclosure: the comment in `execute` saying cobra has already printed the error is false, since the root command silences cobra's errors; it moved unchanged and is left for a follow-up. Model: opus-5-5
12 lines
310 B
Go
12 lines
310 B
Go
package cli
|
|
|
|
// RootCmd and Execute are rootCmd and execute, exported for the external
|
|
// test package, which builds the command tree itself so that it can
|
|
// supply the arguments and read the output.
|
|
//
|
|
//nolint:gochecknoglobals // test seams, not mutable state.
|
|
var (
|
|
RootCmd = rootCmd
|
|
Execute = execute
|
|
)
|