1
0
mirror of synced 2026-03-13 23:26:55 +00:00

minimize diff

Signed-off-by: h3nryc0ding <hr.richterhenry@gmail.com>
This commit is contained in:
h3nryc0ding
2024-12-23 23:13:50 +01:00
parent 8093ad7fef
commit 92e5884664
16 changed files with 24 additions and 24 deletions

View File

@@ -40,11 +40,11 @@ func (a *CRDsPolicy) String() string {
func (a *CRDsPolicy) Set(str string) error {
if strings.TrimSpace(str) == "" {
return fmt.Errorf("no upgrade CRDs policy given, must be one of: %s",
a.Type())
strings.Join(supportedCRDsPolicies, ", "))
}
if !utils.ContainsItemString(supportedCRDsPolicies, str) {
return fmt.Errorf("unsupported upgrade CRDs policy '%s', must be one of: %s",
str, a.Type())
str, strings.Join(supportedCRDsPolicies, ", "))
}
*a = CRDsPolicy(str)

View File

@@ -34,12 +34,11 @@ func (d *DecryptionProvider) String() string {
func (d *DecryptionProvider) Set(str string) error {
if strings.TrimSpace(str) == "" {
return fmt.Errorf("no decryption provider given, must be one of: %s",
d.Type())
strings.Join(supportedDecryptionProviders, ", "))
}
if !utils.ContainsItemString(supportedDecryptionProviders, str) {
return fmt.Errorf("unsupported decryption provider '%s', must be one of: %s",
str, d.Type())
str, strings.Join(supportedDecryptionProviders, ", "))
}
*d = DecryptionProvider(str)
return nil

View File

@@ -45,7 +45,7 @@ func (c *ECDSACurve) Set(str string) error {
*c = ECDSACurve{v}
return nil
}
return fmt.Errorf("unsupported curve '%s', must be one of: %s", str, c.Type())
return fmt.Errorf("unsupported curve '%s', must be one of: %s", str, strings.Join(ecdsaCurves(), ", "))
}
func (c *ECDSACurve) Type() string {

View File

@@ -52,7 +52,8 @@ func (d *GitLabVisibility) Set(str string) error {
}
var visibility = gitprovider.RepositoryVisibility(str)
if ValidateRepositoryVisibility(visibility) != nil {
return fmt.Errorf("unsupported visibility '%s', must be one of: %s", str, d.Type())
return fmt.Errorf("unsupported visibility '%s', must be one of: %s",
str, strings.Join(gitLabVisibilities(), ", "))
}
*d = GitLabVisibility(visibility)
return nil

View File

@@ -53,7 +53,7 @@ func (s *HelmChartSource) Set(str string) error {
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedHelmChartSourceKinds, sourceKind)
if !ok {
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s",
sourceKind, s.Type())
sourceKind, strings.Join(supportedHelmChartSourceKinds, ", "))
}
s.Kind = cleanSourceKind

View File

@@ -60,7 +60,7 @@ func (s *KustomizationSource) Set(str string) error {
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedKustomizationSourceKinds, sourceKind)
if !ok {
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s",
sourceKind, s.Type())
sourceKind, strings.Join(supportedKustomizationSourceKinds, ", "))
}
s.Kind = cleanSourceKind

View File

@@ -48,7 +48,7 @@ func (s *LocalHelmChartSource) Set(str string) error {
cleanSourceKind, ok := utils.ContainsEqualFoldItemString(supportedHelmChartSourceKinds, sourceKind)
if !ok {
return fmt.Errorf("source kind '%s' is not supported, must be one of: %s",
sourceKind, s.Type())
sourceKind, strings.Join(supportedHelmChartSourceKinds, ", "))
}
s.Kind = cleanSourceKind

View File

@@ -34,11 +34,11 @@ func (l *LogLevel) String() string {
func (l *LogLevel) Set(str string) error {
if strings.TrimSpace(str) == "" {
return fmt.Errorf("no log level given, must be one of: %s",
l.Type())
strings.Join(supportedLogLevels, ", "))
}
if !utils.ContainsItemString(supportedLogLevels, str) {
return fmt.Errorf("unsupported log level '%s', must be one of: %s",
str, l.Type())
str, strings.Join(supportedLogLevels, ", "))
}
*l = LogLevel(str)

View File

@@ -32,7 +32,7 @@ func (a *PublicKeyAlgorithm) String() string {
func (a *PublicKeyAlgorithm) Set(str string) error {
if strings.TrimSpace(str) == "" {
return fmt.Errorf("no public key algorithm given, must be one of: %s",
a.Type())
strings.Join(supportedPublicKeyAlgorithms, ", "))
}
for _, v := range supportedPublicKeyAlgorithms {
if str == v {
@@ -41,7 +41,7 @@ func (a *PublicKeyAlgorithm) Set(str string) error {
}
}
return fmt.Errorf("unsupported public key algorithm '%s', must be one of: %s",
str, a.Type())
str, strings.Join(supportedPublicKeyAlgorithms, ", "))
}
func (a *PublicKeyAlgorithm) Type() string {

View File

@@ -45,7 +45,7 @@ func (p *SourceBucketProvider) Set(str string) error {
}
if !utils.ContainsItemString(supportedSourceBucketProviders, str) {
return fmt.Errorf("source bucket provider '%s' is not supported, must be one of: %v",
str, p.Type())
str, strings.Join(supportedSourceBucketProviders, ", "))
}
*p = SourceBucketProvider(str)
return nil

View File

@@ -37,12 +37,12 @@ func (p *SourceGitProvider) String() string {
func (p *SourceGitProvider) Set(str string) error {
if strings.TrimSpace(str) == "" {
return fmt.Errorf("no source Git provider given, must be one of: %s",
p.Type())
return fmt.Errorf("no source Git provider given, please specify %s",
p.Description())
}
if !utils.ContainsItemString(supportedSourceGitProviders, str) {
return fmt.Errorf("source Git provider '%s' is not supported, must be one of: %v",
str, p.Type())
str, strings.Join(supportedSourceGitProviders, ", "))
}
*p = SourceGitProvider(str)
return nil

View File

@@ -52,7 +52,7 @@ func (p *SourceOCIProvider) Set(str string) error {
}
if !utils.ContainsItemString(supportedSourceOCIProviders, str) {
return fmt.Errorf("source OCI provider '%s' is not supported, must be one of: %v",
str, p.Type())
str, strings.Join(supportedSourceOCIProviders, ", "))
}
*p = SourceOCIProvider(str)
return nil

View File

@@ -40,7 +40,7 @@ func (p *SourceOCIVerifyProvider) Set(str string) error {
}
if !utils.ContainsItemString(supportedSourceOCIVerifyProviders, str) {
return fmt.Errorf("source OCI verify provider '%s' is not supported, must be one of: %v",
str, p.Type())
str, strings.Join(supportedSourceOCIVerifyProviders, ", "))
}
*p = SourceOCIVerifyProvider(str)
return nil