Move the command tree into internal/cli (closes #8)
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:
2026-09-29 01:51:34 +02:00
parent 16649e0f2f
commit 09a5caa8ab
8 changed files with 116 additions and 21 deletions
+11
View File
@@ -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
)