diff --git a/cmd/quill/cli/cli.go b/cmd/quill/cli/cli.go index 0d71a2c..73c8277 100644 --- a/cmd/quill/cli/cli.go +++ b/cmd/quill/cli/cli.go @@ -15,10 +15,11 @@ import ( func New(id clio.Identification) *cobra.Command { clioCfg := clio.NewSetupConfig(id). - WithGlobalConfigFlag(). - WithGlobalLoggingFlags(). - WithConfigInRootHelp(). + WithGlobalConfigFlag(). // add persistent -c for reading an application config from + WithGlobalLoggingFlags(). // add persistent -v and -q flags tied to the logging config + WithConfigInRootHelp(). // --help on the root command renders the full application config in the help text WithUIConstructor( + // select a UI based on the logging configuration and state of stdin (if stdin is a tty) func(cfg clio.Config) ([]clio.UI, error) { noUI := ui.None() if !cfg.Log.AllowUI(os.Stdin) { @@ -33,6 +34,9 @@ func New(id clio.Identification) *cobra.Command { ). WithInitializers( func(state *clio.State) error { + // clio is setting up and providing the bus, redact store, and logger to the application. Once loaded, + // we can hoist them into the internal packages for global use. + bus.Set(state.Bus) redact.Set(state.RedactStore) log.Set(state.Logger)