2ce6622055
Refactor main() into run() int (main calls os.Exit(run())) so the test can exercise the CLI directly without os.Exit terminating the test process. Add main_test.go with two cases: run() success path (version command → exit 0) and run() error path (job run with missing spec → exit 1, stderr contains "error:"). Low-effort toe-hold per RESEARCH §1.1/§1.4 — do not over-invest in glue-code coverage. Coverage: go test -cover ./cmd/orca → 80.0% (was 0%, target ≥50%). go test -race PASS. ---ci--- project: orca phase: 1 milestone: v0.8 status: execute ---/ci---
24 lines
425 B
Go
24 lines
425 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"git.cloudinit.dev/coreci/orca/internal/cli"
|
|
)
|
|
|
|
func main() {
|
|
os.Exit(run())
|
|
}
|
|
|
|
// run executes the orca CLI and returns the process exit code. It is
|
|
// extracted from main so tests can exercise the error path without
|
|
// os.Exit terminating the test process.
|
|
func run() int {
|
|
if err := cli.Execute(); err != nil {
|
|
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
|
return 1
|
|
}
|
|
return 0
|
|
}
|