mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-09 09:17:27 +00:00
remove duplicated available options from description
Signed-off-by: h3nryc0ding <hr.richterhenry@gmail.com>
This commit is contained in:
parent
64739b4019
commit
4404634331
15 changed files with 27 additions and 48 deletions
|
|
@ -152,7 +152,7 @@ func TestCreateSourceGitExport(t *testing.T) {
|
|||
{
|
||||
name: "source with empty provider",
|
||||
args: "create source git podinfo --namespace=flux-system --url=https://dev.azure.com/foo/bar/_git/podinfo --provider \"\" --branch=test --interval=1m0s --export",
|
||||
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, please specify the Git provider name, available options are: (generic|azure)"),
|
||||
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, must be one of: generic|azure"),
|
||||
},
|
||||
{
|
||||
name: "source with no provider",
|
||||
|
|
|
|||
|
|
@ -56,5 +56,5 @@ func (a *CRDsPolicy) Type() string {
|
|||
}
|
||||
|
||||
func (a *CRDsPolicy) Description() string {
|
||||
return fmt.Sprintf("upgrade CRDs policy, available options are: (%s)", a.Type())
|
||||
return "upgrade CRDs policy"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,5 +50,5 @@ func (d *DecryptionProvider) Type() string {
|
|||
}
|
||||
|
||||
func (d *DecryptionProvider) Description() string {
|
||||
return fmt.Sprintf("decryption provider, available options are: (%s)", d.Type())
|
||||
return "decryption provider"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ func (c *ECDSACurve) Type() string {
|
|||
}
|
||||
|
||||
func (c *ECDSACurve) Description() string {
|
||||
return fmt.Sprintf("SSH ECDSA public key curve, available options are: (%s)", c.Type())
|
||||
return "SSH ECDSA public key curve"
|
||||
}
|
||||
|
||||
func ecdsaCurves() []string {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package flags
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/fluxcd/go-git-providers/gitprovider"
|
||||
|
|
@ -58,16 +59,18 @@ func (d *GitLabVisibility) Set(str string) error {
|
|||
}
|
||||
|
||||
func (d *GitLabVisibility) Type() string {
|
||||
return strings.Join(gitLabVisibilities(), "|")
|
||||
}
|
||||
|
||||
func (d *GitLabVisibility) Description() string {
|
||||
return "specifies the visibility of the repository"
|
||||
}
|
||||
|
||||
func gitLabVisibilities() []string {
|
||||
visibilities := make([]string, 0, len(supportedGitLabVisibilities))
|
||||
for visibility := range supportedGitLabVisibilities {
|
||||
visibilities = append(visibilities, string(visibility))
|
||||
}
|
||||
return strings.Join(visibilities, "|")
|
||||
}
|
||||
|
||||
func (d *GitLabVisibility) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"specifies the visibility of the repository, available options are: (%s)",
|
||||
d.Type(),
|
||||
)
|
||||
sort.Strings(visibilities)
|
||||
return visibilities
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,9 +68,5 @@ func (s *HelmChartSource) Type() string {
|
|||
}
|
||||
|
||||
func (s *HelmChartSource) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"source that contains the chart in the format '<kind>/<name>.<namespace>', "+
|
||||
"where kind must be one of: (%s)",
|
||||
s.Type(),
|
||||
)
|
||||
return "source that contains the chart in the format '<kind>/<name>.<namespace>'"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,9 +75,5 @@ func (s *KustomizationSource) Type() string {
|
|||
}
|
||||
|
||||
func (s *KustomizationSource) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', "+
|
||||
"where kind must be one of: (%s), if kind is not specified it defaults to GitRepository",
|
||||
s.Type(),
|
||||
)
|
||||
return "source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', if kind is not specified it defaults to GitRepository"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,9 +62,5 @@ func (s *LocalHelmChartSource) Type() string {
|
|||
}
|
||||
|
||||
func (s *LocalHelmChartSource) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"source that contains the chart in the format '<kind>/<name>', "+
|
||||
"where kind must be one of: (%s)",
|
||||
s.Type(),
|
||||
)
|
||||
return "source that contains the chart in the format '<kind>/<name>'"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,5 +50,5 @@ func (l *LogLevel) Type() string {
|
|||
}
|
||||
|
||||
func (l *LogLevel) Description() string {
|
||||
return fmt.Sprintf("log level, available options are: (%s)", l.Type())
|
||||
return "log level"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,5 +49,5 @@ func (a *PublicKeyAlgorithm) Type() string {
|
|||
}
|
||||
|
||||
func (a *PublicKeyAlgorithm) Description() string {
|
||||
return fmt.Sprintf("SSH public key algorithm, available options are: (%s)", a.Type())
|
||||
return "SSH public key algorithm"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ func (b *RSAKeyBits) Set(str string) error {
|
|||
}
|
||||
|
||||
func (b *RSAKeyBits) Type() string {
|
||||
return "rsaKeyBits"
|
||||
return "int"
|
||||
}
|
||||
|
||||
func (b *RSAKeyBits) Description() string {
|
||||
|
|
|
|||
|
|
@ -56,8 +56,5 @@ func (p *SourceBucketProvider) Type() string {
|
|||
}
|
||||
|
||||
func (p *SourceBucketProvider) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"the S3 compatible storage provider name, available options are: (%s)",
|
||||
p.Type(),
|
||||
)
|
||||
return "the S3 compatible storage provider name"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ func (p *SourceGitProvider) String() string {
|
|||
|
||||
func (p *SourceGitProvider) Set(str string) error {
|
||||
if strings.TrimSpace(str) == "" {
|
||||
return fmt.Errorf("no source Git provider given, please specify %s",
|
||||
p.Description())
|
||||
return fmt.Errorf("no source Git provider given, must be one of: %s",
|
||||
p.Type())
|
||||
}
|
||||
if !utils.ContainsItemString(supportedSourceGitProviders, str) {
|
||||
return fmt.Errorf("source Git provider '%s' is not supported, must be one of: %v",
|
||||
|
|
@ -53,8 +53,5 @@ func (p *SourceGitProvider) Type() string {
|
|||
}
|
||||
|
||||
func (p *SourceGitProvider) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"the Git provider name, available options are: (%s)",
|
||||
p.Type(),
|
||||
)
|
||||
return "the Git provider name"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,10 +63,7 @@ func (p *SourceOCIProvider) Type() string {
|
|||
}
|
||||
|
||||
func (p *SourceOCIProvider) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"the OCI provider name, available options are: (%s)",
|
||||
p.Type(),
|
||||
)
|
||||
return "the OCI provider name"
|
||||
}
|
||||
|
||||
func (p *SourceOCIProvider) ToOCIProvider() (oci.Provider, error) {
|
||||
|
|
|
|||
|
|
@ -51,8 +51,5 @@ func (p *SourceOCIVerifyProvider) Type() string {
|
|||
}
|
||||
|
||||
func (p *SourceOCIVerifyProvider) Description() string {
|
||||
return fmt.Sprintf(
|
||||
"the OCI verify provider name to use for signature verification, available options are: (%s)",
|
||||
p.Type(),
|
||||
)
|
||||
return "the OCI verify provider name to use for signature verification"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue