feat(lifecycle/cli): run native commands inside selected modules
This commit is contained in:
1 parent
1b7565113c
commit
e0673630d5
7 files changed
+762
-29
No files matched your search
@@ -63,6 +63,27 @@ for at least two signals, and subscription cleanup. Nil signals disable receptio
|
||||
There are no signal subscriptions, process exits, external dependencies or CLI
|
||||
integration in this package.
|
||||
|
||||
## lifecycle/cli
|
||||
|
||||
`go.auvem.com/corestack/lifecycle/cli` adapts native `urfave/cli/v3` commands.
|
||||
Bind `Serve(config, modules)` to run selected services, or `Action(config, modules,
|
||||
fn)` for a one-off with selected setup/cleanup and module services suppressed.
|
||||
See the [executable serve/inspect example](lifecycle/cli/example_test.go).
|
||||
|
||||
`Run(ctx, cliRoot, args)` accepts argv including the program name and returns the
|
||||
exit code and inspectable error: success/help/graceful first signal is 0, usage is
|
||||
2, and runtime/lifecycle failure is 1. Runtime failures dominate mixed errors.
|
||||
Run prints diagnostics without exiting; the caller owns process exit. Nil signals
|
||||
subscribe to SIGINT/SIGTERM during adapted actions; injected channels stay caller
|
||||
owned. The private lifecycle App does not expose managed-worker admission.
|
||||
|
||||
Use fresh command trees and leave `ExitErrHandler`, `OnUsageError` and
|
||||
`CommandNotFound` unset; Run owns those hooks. Other native hooks run outside the
|
||||
adapted lifecycle action. Native environment/custom validation and generated-help
|
||||
parse failures can return 1 with native diagnostics; custom pre-lifecycle
|
||||
validators may return `urfavecli.Exit(err, 2)` for usage. Help and flags use native
|
||||
urfave/cli declarations, without a configuration or environment facade.
|
||||
|
||||
## Status
|
||||
|
||||
No support is guaranteed. Breaking changes, including to the format rules, may happen before 1.0 and are listed in the release notes.
|
||||
|
||||
Reference in new issue
Block a user