Skip to content

Commit

Permalink
chore: update to latest clio
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Zantow <kzantow@gmail.com>
  • Loading branch information
kzantow committed Jun 30, 2023
1 parent d82015c commit f908f7d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
11 changes: 8 additions & 3 deletions cmd/quill/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ func New(id clio.Identification) *cobra.Command {
WithInitializers(
func(state *clio.State) error {
bus.Set(state.Bus)
// must set the redact store before calling log.Set
log.SetRedactStore(state.RedactStore)
log.Set(state.Logger)
// note: we want to ensure that the clio application object has redaction capability
// so that the configuration (which has sensitive information) is redacted when printed to the screen
state.Logger = log.Get()
return nil
},
)
).
WithGlobalConfigFlag().
WithGlobalLoggingFlags().
WithConfigInRootHelp()

root := &cobra.Command{}
app := clio.New(*clioCfg)

app := clio.New(*clioCfg, root)
root := commands.Root(app)

submission := commands.Submission(app)
submission.AddCommand(commands.SubmissionList(app))
Expand Down
11 changes: 11 additions & 0 deletions cmd/quill/cli/commands/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package commands

import (
"github.com/spf13/cobra"

"github.com/anchore/clio"
)

func Root(app clio.Application) *cobra.Command {
return app.SetupRootCommand(&cobra.Command{})
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/anchore/bubbly v0.0.0-20230518153401-87b6af8ccf22
github.com/anchore/clio v0.0.0-20230531204310-4a8bc623b049
github.com/anchore/fangs v0.0.0-20230531202914-48a718c6b4ba
github.com/anchore/clio v0.0.0-20230630145036-8c79eb7c59a2
github.com/anchore/fangs v0.0.0-20230628163043-a51c5a39b097
github.com/anchore/go-logger v0.0.0-20230531193951-db5ae83e7dbe
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb
github.com/aws/aws-sdk-go v1.44.114
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/anchore/bubbly v0.0.0-20230518153401-87b6af8ccf22 h1:5NFK6VGgqBUOAX2SYyzFYvNdOiYDxzim8jga386FlZY=
github.com/anchore/bubbly v0.0.0-20230518153401-87b6af8ccf22/go.mod h1:Kv+Mm9CdtnV8iem48iEPIwy7/N4Wmk0hpxYNH5gTwKQ=
github.com/anchore/clio v0.0.0-20230531204310-4a8bc623b049 h1:zxyFABR9NlcjsgiumKEBfQyOu8h9hgBZ0U/BVlYcsI0=
github.com/anchore/clio v0.0.0-20230531204310-4a8bc623b049/go.mod h1:q5s//y4jA9/wxYNGxgkeCtgkJu6fZgS18gO3lVxSbHs=
github.com/anchore/fangs v0.0.0-20230531202914-48a718c6b4ba h1:tJ186HK8e0Lf+hhNWX4fJrq14yj3mw8JQkkLhA0nFhE=
github.com/anchore/fangs v0.0.0-20230531202914-48a718c6b4ba/go.mod h1:E3zNHEz7mizIFGJhuX+Ga7AbCmEN5TfzVDxmOfj7XZw=
github.com/anchore/clio v0.0.0-20230630145036-8c79eb7c59a2 h1:URAz4nFfdtJkafTvW7boPjNdJGO1vOLwXjUmWmh1NkA=
github.com/anchore/clio v0.0.0-20230630145036-8c79eb7c59a2/go.mod h1:luJXPVJ6im+wAQ+gagb2ocyihE0nBvS1NWtSlQSJGsE=
github.com/anchore/fangs v0.0.0-20230628163043-a51c5a39b097 h1:79jSyWO6WOV8HPEpOQBOr7WsC2DnBRpyl7zsdaahCcg=
github.com/anchore/fangs v0.0.0-20230628163043-a51c5a39b097/go.mod h1:E3zNHEz7mizIFGJhuX+Ga7AbCmEN5TfzVDxmOfj7XZw=
github.com/anchore/go-logger v0.0.0-20230531193951-db5ae83e7dbe h1:Df867YMmymdMG6z5IW8pR0/2CRpLIjYnaTXLp6j+s0k=
github.com/anchore/go-logger v0.0.0-20230531193951-db5ae83e7dbe/go.mod h1:ubLFmlsv8/DFUQrZwY5syT5/8Er3ugSr4rDFwHsE3hg=
github.com/anchore/go-macholibre v0.0.0-20220308212642-53e6d0aaf6fb h1:iDMnx6LIjtjZ46C0akqveX83WFzhpTD3eqOthawb5vU=
Expand Down
7 changes: 6 additions & 1 deletion internal/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ var (

store = redact.NewStore()

Redactor = store.(redact.Redactor)
Redactor redact.Redactor = store
)

func SetRedactStore(s redact.Store) {
store = s
Redactor = s
}

func Set(l logger.Logger) {
log = redact.New(l, store)
}
Expand Down

0 comments on commit f908f7d

Please sign in to comment.