Skip to content

Commit ee98653

Browse files
committed
fix(cli): stand up Init's cli via Register, not core.WithCli()
core.WithCli() inside core/cli forces the default cli back in (the very thing removed from core.New) and double-registers when an app also adds the cli service. Init now stands up the cli the one consistent way — via the package's own Register service. Co-Authored-By: Virgil <virgil@lethean.io>
1 parent 10315f4 commit ee98653

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

go/pkg/cli/runtime.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@ func Init(opts Options) core.Result {
7070

7171
ctx, cancel := context.WithCancel(context.Background())
7272

73-
// Create Core instance + opt in the CLI primitive (core.New no longer
74-
// auto-registers it).
73+
// Create Core instance, then stand up the CLI via the package's own
74+
// service (registers the primitive once) — never core.WithCli() here, which
75+
// would force the default cli back in and double-register.
7576
c := core.New(
7677
core.WithOption("name", opts.AppName),
77-
core.WithCli(),
7878
)
79+
if r := Register(c); !r.OK {
80+
cancel()
81+
return r
82+
}
7983
c.App().Name = opts.AppName
8084
c.App().Version = opts.Version
8185

0 commit comments

Comments
 (0)