From f908f7d4ea8662987b0cfd01c542416584762b38 Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Fri, 30 Jun 2023 10:55:05 -0400 Subject: [PATCH] chore: update to latest clio Signed-off-by: Keith Zantow --- cmd/quill/cli/cli.go | 11 ++++++++--- cmd/quill/cli/commands/root.go | 11 +++++++++++ go.mod | 4 ++-- go.sum | 8 ++++---- internal/log/log.go | 7 ++++++- 5 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 cmd/quill/cli/commands/root.go diff --git a/cmd/quill/cli/cli.go b/cmd/quill/cli/cli.go index 2b2b919..349a46b 100644 --- a/cmd/quill/cli/cli.go +++ b/cmd/quill/cli/cli.go @@ -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)) diff --git a/cmd/quill/cli/commands/root.go b/cmd/quill/cli/commands/root.go new file mode 100644 index 0000000..f190c87 --- /dev/null +++ b/cmd/quill/cli/commands/root.go @@ -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{}) +} diff --git a/go.mod b/go.mod index 2c865d3..bd1f06c 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 03b4417..e32fa83 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/internal/log/log.go b/internal/log/log.go index 3425e04..11a265f 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -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) }