Merge pull request #5602 from jaxels10/main

fix: return accepted values for flags when calling Values.Type()
pull/5597/merge
Matheus Pimenta 4 days ago committed by GitHub
commit 31287b9b27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -52,9 +52,9 @@ func (a *CRDsPolicy) Set(str string) error {
} }
func (a *CRDsPolicy) Type() string { func (a *CRDsPolicy) Type() string {
return "crds" return strings.Join(supportedCRDsPolicies, "|")
} }
func (a *CRDsPolicy) Description() string { func (a *CRDsPolicy) Description() string {
return fmt.Sprintf("upgrade CRDs policy, available options are: (%s)", strings.Join(supportedCRDsPolicies, ", ")) return "upgrade CRDs policy"
} }

@ -49,11 +49,16 @@ func (c *ECDSACurve) Set(str string) error {
} }
func (c *ECDSACurve) Type() string { func (c *ECDSACurve) Type() string {
return "ecdsaCurve" keys := make([]string, 0, len(supportedECDSACurves))
for k := range supportedECDSACurves {
keys = append(keys, k)
}
sort.Strings(keys)
return strings.Join(keys, "|")
} }
func (c *ECDSACurve) Description() string { func (c *ECDSACurve) Description() string {
return fmt.Sprintf("SSH ECDSA public key curve (%s)", strings.Join(ecdsaCurves(), ", ")) return "SSH ECDSA public key curve"
} }
func ecdsaCurves() []string { func ecdsaCurves() []string {

@ -58,9 +58,13 @@ func (d *GitLabVisibility) Set(str string) error {
} }
func (d *GitLabVisibility) Type() string { func (d *GitLabVisibility) Type() string {
return "gitLabVisibility" keys := make([]string, 0, len(supportedGitLabVisibilities))
for v := range supportedGitLabVisibilities {
keys = append(keys, string(v))
}
return strings.Join(keys, "|")
} }
func (d *GitLabVisibility) Description() string { func (d *GitLabVisibility) Description() string {
return fmt.Sprintf("specifies the visibility of the repository. Valid values are public, private, internal") return "specifies the visibility of the repository"
} }

@ -64,7 +64,7 @@ func (s *HelmChartSource) Set(str string) error {
} }
func (s *HelmChartSource) Type() string { func (s *HelmChartSource) Type() string {
return "helmChartSource" return "string"
} }
func (s *HelmChartSource) Description() string { func (s *HelmChartSource) Description() string {

@ -70,7 +70,7 @@ func (s *KustomizationSource) Set(str string) error {
} }
func (s *KustomizationSource) Type() string { func (s *KustomizationSource) Type() string {
return "kustomizationSource" return "string"
} }
func (s *KustomizationSource) Description() string { func (s *KustomizationSource) Description() string {

@ -46,9 +46,9 @@ func (l *LogLevel) Set(str string) error {
} }
func (l *LogLevel) Type() string { func (l *LogLevel) Type() string {
return "logLevel" return strings.Join(supportedLogLevels, "|")
} }
func (l *LogLevel) Description() string { func (l *LogLevel) Description() string {
return fmt.Sprintf("log level, available options are: (%s)", strings.Join(supportedLogLevels, ", ")) return "log level"
} }

@ -45,9 +45,9 @@ func (a *PublicKeyAlgorithm) Set(str string) error {
} }
func (a *PublicKeyAlgorithm) Type() string { func (a *PublicKeyAlgorithm) Type() string {
return "publicKeyAlgorithm" return strings.Join(supportedPublicKeyAlgorithms, "|")
} }
func (a *PublicKeyAlgorithm) Description() string { func (a *PublicKeyAlgorithm) Description() string {
return fmt.Sprintf("SSH public key algorithm (%s)", strings.Join(supportedPublicKeyAlgorithms, ", ")) return "SSH public key algorithm"
} }

@ -52,12 +52,9 @@ func (p *SourceBucketProvider) Set(str string) error {
} }
func (p *SourceBucketProvider) Type() string { func (p *SourceBucketProvider) Type() string {
return "sourceBucketProvider" return strings.Join(supportedSourceBucketProviders, "|")
} }
func (p *SourceBucketProvider) Description() string { func (p *SourceBucketProvider) Description() string {
return fmt.Sprintf( return "the S3 compatible storage provider name"
"the S3 compatible storage provider name, available options are: (%s)",
strings.Join(supportedSourceBucketProviders, ", "),
)
} }

@ -52,12 +52,9 @@ func (p *SourceOCIProvider) Set(str string) error {
} }
func (p *SourceOCIProvider) Type() string { func (p *SourceOCIProvider) Type() string {
return "sourceOCIProvider" return strings.Join(supportedSourceOCIProviders, "|")
} }
func (p *SourceOCIProvider) Description() string { func (p *SourceOCIProvider) Description() string {
return fmt.Sprintf( return "the OCI provider name"
"the OCI provider name, available options are: (%s)",
strings.Join(supportedSourceOCIProviders, ", "),
)
} }

Loading…
Cancel
Save