Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add descriptions to configuration fields #98

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/chronicle/cli/commands/create_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions cmd/chronicle/cli/options/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"`
Expand Down
6 changes: 3 additions & 3 deletions cmd/chronicle/cli/options/next_version.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
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",
"major changes bump the minor version field for versions < 1.0",
)
}

var _ fangs.FlagAdder = (*EnforceV0)(nil)
var _ clio.FlagAdder = (*EnforceV0)(nil)
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down