From 4f66515fcfd815d11892b871f166e760a08890bf Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Mon, 7 Aug 2023 13:58:28 -0400 Subject: [PATCH] chore: add descriptions to configuration fields Signed-off-by: Keith Zantow --- cmd/chronicle/cli/commands/create_config.go | 6 +++--- cmd/chronicle/cli/options/github.go | 17 +++++++++++++++++ cmd/chronicle/cli/options/next_version.go | 6 +++--- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/cmd/chronicle/cli/commands/create_config.go b/cmd/chronicle/cli/commands/create_config.go index 4e9957a..3db8883 100644 --- a/cmd/chronicle/cli/commands/create_config.go +++ b/cmd/chronicle/cli/commands/create_config.go @@ -5,7 +5,7 @@ import ( "github.com/anchore/chronicle/chronicle/release/format" "github.com/anchore/chronicle/cmd/chronicle/cli/options" - "github.com/anchore/fangs" + "github.com/anchore/clio" ) type createConfig struct { @@ -20,9 +20,9 @@ type createConfig struct { EnforceV0 options.EnforceV0 `yaml:"enforce-v0" json:"enforce-v0" mapstructure:"enforce-v0"` } -var _ fangs.FlagAdder = (*createConfig)(nil) +var _ clio.FlagAdder = (*createConfig)(nil) -func (c *createConfig) AddFlags(flags fangs.FlagSet) { +func (c *createConfig) AddFlags(flags clio.FlagSet) { flags.StringVarP( &c.Output, "output", "o", diff --git a/cmd/chronicle/cli/options/github.go b/cmd/chronicle/cli/options/github.go index 3c1942c..7529a17 100644 --- a/cmd/chronicle/cli/options/github.go +++ b/cmd/chronicle/cli/options/github.go @@ -3,6 +3,7 @@ package options import ( "github.com/anchore/chronicle/chronicle/release/change" "github.com/anchore/chronicle/chronicle/release/releasers/github" + "github.com/anchore/clio" ) type GithubSummarizer struct { @@ -20,6 +21,22 @@ type GithubSummarizer struct { Changes []GithubChange `yaml:"changes" json:"changes" mapstructure:"changes"` } +func (c *GithubSummarizer) DescribeFields(descriptions clio.FieldDescriptionSet) { + descriptions.Add(&c.Host, "the github host to use") + descriptions.Add(&c.ExcludeLabels, "labels to exclude from changelog") + descriptions.Add(&c.IncludeIssuePRAuthors, "include PR authors in change description") + descriptions.Add(&c.IncludeIssuePRs, "include PR link in change description") + descriptions.Add(&c.IncludeIssuesClosedAsNotPlanned, "include issues closed as not planned") + descriptions.Add(&c.IncludePRs, "include PRs, including those without linked issues") + descriptions.Add(&c.IncludeIssues, "include issues") + descriptions.Add(&c.IncludeUnlabeledIssues, "include issues without labels") + descriptions.Add(&c.IncludeUnlabeledPRs, "include PRs without labels or linked issues") + descriptions.Add(&c.IssuesRequireLinkedPR, "only include issues with linked PRs") + descriptions.Add(&c.ConsiderPRMergeCommits, "include merge commits") +} + +var _ clio.FieldDescriber = (*GithubSummarizer)(nil) + type GithubChange struct { Type string `yaml:"name" json:"name" mapstructure:"name"` Title string `yaml:"title" json:"title" mapstructure:"title"` diff --git a/cmd/chronicle/cli/options/next_version.go b/cmd/chronicle/cli/options/next_version.go index a05676e..7e717d9 100644 --- a/cmd/chronicle/cli/options/next_version.go +++ b/cmd/chronicle/cli/options/next_version.go @@ -1,12 +1,12 @@ package options import ( - "github.com/anchore/fangs" + "github.com/anchore/clio" ) type EnforceV0 bool -func (c *EnforceV0) AddFlags(flags fangs.FlagSet) { +func (c *EnforceV0) AddFlags(flags clio.FlagSet) { flags.BoolVarP( (*bool)(c), "enforce-v0", "e", @@ -14,4 +14,4 @@ func (c *EnforceV0) AddFlags(flags fangs.FlagSet) { ) } -var _ fangs.FlagAdder = (*EnforceV0)(nil) +var _ clio.FlagAdder = (*EnforceV0)(nil) diff --git a/go.mod b/go.mod index 32e92b5..d423d8a 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,7 @@ module github.com/anchore/chronicle go 1.18 require ( - github.com/anchore/clio v0.0.0-20230802135737-4778c80552e5 - github.com/anchore/fangs v0.0.0-20230725134830-329a9a4d20e7 + github.com/anchore/clio v0.0.0-20230807174420-8b6f1b04adc8 github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04 github.com/coreos/go-semver v0.3.1 @@ -25,6 +24,7 @@ require ( github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect github.com/adrg/xdg v0.4.0 // indirect + github.com/anchore/fangs v0.0.0-20230807173929-13c94c86f47e // indirect github.com/cloudflare/circl v1.3.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect @@ -69,8 +69,8 @@ require ( golang.org/x/crypto v0.11.0 // indirect golang.org/x/mod v0.8.0 // indirect golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/term v0.10.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/term v0.11.0 // indirect golang.org/x/text v0.11.0 // indirect golang.org/x/tools v0.6.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index 5852cc3..a7d4dac 100644 --- a/go.sum +++ b/go.sum @@ -49,10 +49,10 @@ github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= -github.com/anchore/clio v0.0.0-20230802135737-4778c80552e5 h1:+8PjffRlKmpulXMCYvZN+S/Abm29e8JSBmcDSdQ8jps= -github.com/anchore/clio v0.0.0-20230802135737-4778c80552e5/go.mod h1:PrUEp9T+mMgEyPvimzwpqgJD6Zfg/9nw0BEGryY3qFo= -github.com/anchore/fangs v0.0.0-20230725134830-329a9a4d20e7 h1:DiG9qj+JNfjodKQN5gn1HwMFJrizc8tH/90AxIwf9Lg= -github.com/anchore/fangs v0.0.0-20230725134830-329a9a4d20e7/go.mod h1:82EGoxZTfBXSW0/zollEP+Qs3wkiKmip5yBT5j+eZpY= +github.com/anchore/clio v0.0.0-20230807174420-8b6f1b04adc8 h1:DPA2ldr+cuSnFZ+XLcbfixvtg5Kjc71EvXK5H+GYLwA= +github.com/anchore/clio v0.0.0-20230807174420-8b6f1b04adc8/go.mod h1:1YX0GEFAbguq8nctgm2JKcHZuXw+ILfZeM8rPNnnaKE= +github.com/anchore/fangs v0.0.0-20230807173929-13c94c86f47e h1:hKwSSaIZn5aRtmDqmDhPc3LQKdRz6HLc23DhCsvIPeU= +github.com/anchore/fangs v0.0.0-20230807173929-13c94c86f47e/go.mod h1:82EGoxZTfBXSW0/zollEP+Qs3wkiKmip5yBT5j+eZpY= github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a h1:nJ2G8zWKASyVClGVgG7sfM5mwoZlZ2zYpIzN2OhjWkw= github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a/go.mod h1:ubLFmlsv8/DFUQrZwY5syT5/8Er3ugSr4rDFwHsE3hg= github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04 h1:VzprUTpc0vW0nnNKJfJieyH/TZ9UYAnTZs5/gHTdAe8= @@ -452,15 +452,15 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=