Skip to content

Commit

Permalink
improve flag descriptions to show allowed values instead of internal …
Browse files Browse the repository at this point in the history
…type names
  • Loading branch information
h3nryc0ding committed Nov 10, 2024
1 parent 2a5948f commit f294490
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/flags/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (a *CRDsPolicy) Set(str string) error {
}

func (a *CRDsPolicy) Type() string {
return "crds"
return strings.Join(supportedCRDsPolicies, "|")
}

func (a *CRDsPolicy) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/decryption_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (d *DecryptionProvider) Set(str string) error {
}

func (d *DecryptionProvider) Type() string {
return "decryptionProvider"
return strings.Join(supportedDecryptionProviders, "|")
}

func (d *DecryptionProvider) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/ecdsa_curve.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (c *ECDSACurve) Set(str string) error {
}

func (c *ECDSACurve) Type() string {
return "ecdsaCurve"
return strings.Join(ecdsaCurves(), "|")
}

func (c *ECDSACurve) Description() string {
Expand Down
6 changes: 5 additions & 1 deletion internal/flags/gitlab_visibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ func (d *GitLabVisibility) Set(str string) error {
}

func (d *GitLabVisibility) Type() string {
return "gitLabVisibility"
visibilities := make([]string, 0, len(supportedGitLabVisibilities))
for visibility := range supportedGitLabVisibilities {
visibilities = append(visibilities, string(visibility))
}
return strings.Join(visibilities, "|")
}

func (d *GitLabVisibility) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/helm_chart_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (s *HelmChartSource) Set(str string) error {
}

func (s *HelmChartSource) Type() string {
return "helmChartSource"
return strings.Join(supportedHelmChartSourceKinds, "|")
}

func (s *HelmChartSource) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/kustomization_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (s *KustomizationSource) Set(str string) error {
}

func (s *KustomizationSource) Type() string {
return "kustomizationSource"
return strings.Join(supportedKustomizationSourceKinds, "|")
}

func (s *KustomizationSource) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/local_helm_chart_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (s *LocalHelmChartSource) Set(str string) error {
}

func (s *LocalHelmChartSource) Type() string {
return "helmChartSource"
return strings.Join(supportedHelmChartSourceKinds, "|")
}

func (s *LocalHelmChartSource) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/log_level.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (l *LogLevel) Set(str string) error {
}

func (l *LogLevel) Type() string {
return "logLevel"
return strings.Join(supportedLogLevels, "|")
}

func (l *LogLevel) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/public_key_algorithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (a *PublicKeyAlgorithm) Set(str string) error {
}

func (a *PublicKeyAlgorithm) Type() string {
return "publicKeyAlgorithm"
return strings.Join(supportedPublicKeyAlgorithms, "|")
}

func (a *PublicKeyAlgorithm) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/source_bucket_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (p *SourceBucketProvider) Set(str string) error {
}

func (p *SourceBucketProvider) Type() string {
return "sourceBucketProvider"
return strings.Join(supportedSourceBucketProviders, "|")
}

func (p *SourceBucketProvider) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/source_oci_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (p *SourceOCIProvider) Set(str string) error {
}

func (p *SourceOCIProvider) Type() string {
return "sourceOCIProvider"
return strings.Join(supportedSourceOCIProviders, "|")
}

func (p *SourceOCIProvider) Description() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/source_oci_verify_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (p *SourceOCIVerifyProvider) Set(str string) error {
}

func (p *SourceOCIVerifyProvider) Type() string {
return "sourceOCIVerifyProvider"
return strings.Join(supportedSourceOCIVerifyProviders, "|")
}

func (p *SourceOCIVerifyProvider) Description() string {
Expand Down

0 comments on commit f294490

Please sign in to comment.