From f294490c03d34b9b724b65be07adf7600f12cd8c Mon Sep 17 00:00:00 2001
From: h3nryc0ding
Date: Sun, 10 Nov 2024 02:37:33 +0000
Subject: [PATCH] improve flag descriptions to show allowed values instead of
internal type names
---
internal/flags/crds.go | 2 +-
internal/flags/decryption_provider.go | 2 +-
internal/flags/ecdsa_curve.go | 2 +-
internal/flags/gitlab_visibility.go | 6 +++++-
internal/flags/helm_chart_source.go | 2 +-
internal/flags/kustomization_source.go | 2 +-
internal/flags/local_helm_chart_source.go | 2 +-
internal/flags/log_level.go | 2 +-
internal/flags/public_key_algorithm.go | 2 +-
internal/flags/source_bucket_provider.go | 2 +-
internal/flags/source_oci_provider.go | 2 +-
internal/flags/source_oci_verify_provider.go | 2 +-
12 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/internal/flags/crds.go b/internal/flags/crds.go
index 81f6d604c8..850688dd8e 100644
--- a/internal/flags/crds.go
+++ b/internal/flags/crds.go
@@ -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 {
diff --git a/internal/flags/decryption_provider.go b/internal/flags/decryption_provider.go
index 085340aba7..8ad3c30222 100644
--- a/internal/flags/decryption_provider.go
+++ b/internal/flags/decryption_provider.go
@@ -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 {
diff --git a/internal/flags/ecdsa_curve.go b/internal/flags/ecdsa_curve.go
index 9be8469bfe..2d9c332425 100644
--- a/internal/flags/ecdsa_curve.go
+++ b/internal/flags/ecdsa_curve.go
@@ -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 {
diff --git a/internal/flags/gitlab_visibility.go b/internal/flags/gitlab_visibility.go
index 924dd898d1..ec0c2aec53 100644
--- a/internal/flags/gitlab_visibility.go
+++ b/internal/flags/gitlab_visibility.go
@@ -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 {
diff --git a/internal/flags/helm_chart_source.go b/internal/flags/helm_chart_source.go
index 079ca4d3d1..a2a925c751 100644
--- a/internal/flags/helm_chart_source.go
+++ b/internal/flags/helm_chart_source.go
@@ -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 {
diff --git a/internal/flags/kustomization_source.go b/internal/flags/kustomization_source.go
index 4dc124ab76..88ecc3b068 100644
--- a/internal/flags/kustomization_source.go
+++ b/internal/flags/kustomization_source.go
@@ -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 {
diff --git a/internal/flags/local_helm_chart_source.go b/internal/flags/local_helm_chart_source.go
index 19d2e5305c..bbb7a592ba 100644
--- a/internal/flags/local_helm_chart_source.go
+++ b/internal/flags/local_helm_chart_source.go
@@ -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 {
diff --git a/internal/flags/log_level.go b/internal/flags/log_level.go
index 4101a90296..5b26d0c0e0 100644
--- a/internal/flags/log_level.go
+++ b/internal/flags/log_level.go
@@ -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 {
diff --git a/internal/flags/public_key_algorithm.go b/internal/flags/public_key_algorithm.go
index ed4902a7a5..325ff6b40e 100644
--- a/internal/flags/public_key_algorithm.go
+++ b/internal/flags/public_key_algorithm.go
@@ -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 {
diff --git a/internal/flags/source_bucket_provider.go b/internal/flags/source_bucket_provider.go
index bd93b41dfc..9c8aaa1932 100644
--- a/internal/flags/source_bucket_provider.go
+++ b/internal/flags/source_bucket_provider.go
@@ -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 {
diff --git a/internal/flags/source_oci_provider.go b/internal/flags/source_oci_provider.go
index 77ff044183..6624c0de77 100644
--- a/internal/flags/source_oci_provider.go
+++ b/internal/flags/source_oci_provider.go
@@ -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 {
diff --git a/internal/flags/source_oci_verify_provider.go b/internal/flags/source_oci_verify_provider.go
index acd57a9d2f..57c8cdde45 100644
--- a/internal/flags/source_oci_verify_provider.go
+++ b/internal/flags/source_oci_verify_provider.go
@@ -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 {