Skip to content

Commit 4404634

Browse files
committed
remove duplicated available options from description
Signed-off-by: h3nryc0ding <[email protected]>
1 parent 64739b4 commit 4404634

15 files changed

+27
-48
lines changed

cmd/flux/create_source_git_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func TestCreateSourceGitExport(t *testing.T) {
152152
{
153153
name: "source with empty provider",
154154
args: "create source git podinfo --namespace=flux-system --url=https://dev.azure.com/foo/bar/_git/podinfo --provider \"\" --branch=test --interval=1m0s --export",
155-
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, please specify the Git provider name, available options are: (generic|azure)"),
155+
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, must be one of: generic|azure"),
156156
},
157157
{
158158
name: "source with no provider",

internal/flags/crds.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ func (a *CRDsPolicy) Type() string {
5656
}
5757

5858
func (a *CRDsPolicy) Description() string {
59-
return fmt.Sprintf("upgrade CRDs policy, available options are: (%s)", a.Type())
59+
return "upgrade CRDs policy"
6060
}

internal/flags/decryption_provider.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ func (d *DecryptionProvider) Type() string {
5050
}
5151

5252
func (d *DecryptionProvider) Description() string {
53-
return fmt.Sprintf("decryption provider, available options are: (%s)", d.Type())
53+
return "decryption provider"
5454
}

internal/flags/ecdsa_curve.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (c *ECDSACurve) Type() string {
5353
}
5454

5555
func (c *ECDSACurve) Description() string {
56-
return fmt.Sprintf("SSH ECDSA public key curve, available options are: (%s)", c.Type())
56+
return "SSH ECDSA public key curve"
5757
}
5858

5959
func ecdsaCurves() []string {

internal/flags/gitlab_visibility.go

+11-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package flags
1818

1919
import (
2020
"fmt"
21+
"sort"
2122
"strings"
2223

2324
"github.com/fluxcd/go-git-providers/gitprovider"
@@ -58,16 +59,18 @@ func (d *GitLabVisibility) Set(str string) error {
5859
}
5960

6061
func (d *GitLabVisibility) Type() string {
62+
return strings.Join(gitLabVisibilities(), "|")
63+
}
64+
65+
func (d *GitLabVisibility) Description() string {
66+
return "specifies the visibility of the repository"
67+
}
68+
69+
func gitLabVisibilities() []string {
6170
visibilities := make([]string, 0, len(supportedGitLabVisibilities))
6271
for visibility := range supportedGitLabVisibilities {
6372
visibilities = append(visibilities, string(visibility))
6473
}
65-
return strings.Join(visibilities, "|")
66-
}
67-
68-
func (d *GitLabVisibility) Description() string {
69-
return fmt.Sprintf(
70-
"specifies the visibility of the repository, available options are: (%s)",
71-
d.Type(),
72-
)
74+
sort.Strings(visibilities)
75+
return visibilities
7376
}

internal/flags/helm_chart_source.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,5 @@ func (s *HelmChartSource) Type() string {
6868
}
6969

7070
func (s *HelmChartSource) Description() string {
71-
return fmt.Sprintf(
72-
"source that contains the chart in the format '<kind>/<name>.<namespace>', "+
73-
"where kind must be one of: (%s)",
74-
s.Type(),
75-
)
71+
return "source that contains the chart in the format '<kind>/<name>.<namespace>'"
7672
}

internal/flags/kustomization_source.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,5 @@ func (s *KustomizationSource) Type() string {
7575
}
7676

7777
func (s *KustomizationSource) Description() string {
78-
return fmt.Sprintf(
79-
"source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', "+
80-
"where kind must be one of: (%s), if kind is not specified it defaults to GitRepository",
81-
s.Type(),
82-
)
78+
return "source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', if kind is not specified it defaults to GitRepository"
8379
}

internal/flags/local_helm_chart_source.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,5 @@ func (s *LocalHelmChartSource) Type() string {
6262
}
6363

6464
func (s *LocalHelmChartSource) Description() string {
65-
return fmt.Sprintf(
66-
"source that contains the chart in the format '<kind>/<name>', "+
67-
"where kind must be one of: (%s)",
68-
s.Type(),
69-
)
65+
return "source that contains the chart in the format '<kind>/<name>'"
7066
}

internal/flags/log_level.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ func (l *LogLevel) Type() string {
5050
}
5151

5252
func (l *LogLevel) Description() string {
53-
return fmt.Sprintf("log level, available options are: (%s)", l.Type())
53+
return "log level"
5454
}

internal/flags/public_key_algorithm.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ func (a *PublicKeyAlgorithm) Type() string {
4949
}
5050

5151
func (a *PublicKeyAlgorithm) Description() string {
52-
return fmt.Sprintf("SSH public key algorithm, available options are: (%s)", a.Type())
52+
return "SSH public key algorithm"
5353
}

internal/flags/rsa_key_bits.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (b *RSAKeyBits) Set(str string) error {
5050
}
5151

5252
func (b *RSAKeyBits) Type() string {
53-
return "rsaKeyBits"
53+
return "int"
5454
}
5555

5656
func (b *RSAKeyBits) Description() string {

internal/flags/source_bucket_provider.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,5 @@ func (p *SourceBucketProvider) Type() string {
5656
}
5757

5858
func (p *SourceBucketProvider) Description() string {
59-
return fmt.Sprintf(
60-
"the S3 compatible storage provider name, available options are: (%s)",
61-
p.Type(),
62-
)
59+
return "the S3 compatible storage provider name"
6360
}

internal/flags/source_git_provider.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ func (p *SourceGitProvider) String() string {
3737

3838
func (p *SourceGitProvider) Set(str string) error {
3939
if strings.TrimSpace(str) == "" {
40-
return fmt.Errorf("no source Git provider given, please specify %s",
41-
p.Description())
40+
return fmt.Errorf("no source Git provider given, must be one of: %s",
41+
p.Type())
4242
}
4343
if !utils.ContainsItemString(supportedSourceGitProviders, str) {
4444
return fmt.Errorf("source Git provider '%s' is not supported, must be one of: %v",
@@ -53,8 +53,5 @@ func (p *SourceGitProvider) Type() string {
5353
}
5454

5555
func (p *SourceGitProvider) Description() string {
56-
return fmt.Sprintf(
57-
"the Git provider name, available options are: (%s)",
58-
p.Type(),
59-
)
56+
return "the Git provider name"
6057
}

internal/flags/source_oci_provider.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ func (p *SourceOCIProvider) Type() string {
6363
}
6464

6565
func (p *SourceOCIProvider) Description() string {
66-
return fmt.Sprintf(
67-
"the OCI provider name, available options are: (%s)",
68-
p.Type(),
69-
)
66+
return "the OCI provider name"
7067
}
7168

7269
func (p *SourceOCIProvider) ToOCIProvider() (oci.Provider, error) {

internal/flags/source_oci_verify_provider.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,5 @@ func (p *SourceOCIVerifyProvider) Type() string {
5151
}
5252

5353
func (p *SourceOCIVerifyProvider) Description() string {
54-
return fmt.Sprintf(
55-
"the OCI verify provider name to use for signature verification, available options are: (%s)",
56-
p.Type(),
57-
)
54+
return "the OCI verify provider name to use for signature verification"
5855
}

0 commit comments

Comments
 (0)