Skip to content

Commit

Permalink
add comments to the clio setup steps
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman committed Jun 30, 2023
1 parent 7e40d5b commit 20fb597
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/quill/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import (

func New(id clio.Identification) *cobra.Command {
clioCfg := clio.NewSetupConfig(id).
WithGlobalConfigFlag().
WithGlobalLoggingFlags().
WithConfigInRootHelp().
WithGlobalConfigFlag(). // add persistent -c <path> 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) {
Expand All @@ -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)
Expand Down

0 comments on commit 20fb597

Please sign in to comment.