Move the command tree into internal/cli (closes #8)
check / check (push) Successful in 1m40s
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
This commit was merged in pull request #9.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
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
|
||||
)
|
||||
Reference in New Issue
Block a user