mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-20 06:31:47 +00:00
remove duplicated available options from description
Signed-off-by: h3nryc0ding <hr.richterhenry@gmail.com>
This commit is contained in:
parent
64739b4019
commit
4404634331
15 changed files with 27 additions and 48 deletions
|
|
@ -152,7 +152,7 @@ func TestCreateSourceGitExport(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "source with empty provider",
|
name: "source with empty provider",
|
||||||
args: "create source git podinfo --namespace=flux-system --url=https://dev.azure.com/foo/bar/_git/podinfo --provider \"\" --branch=test --interval=1m0s --export",
|
args: "create source git podinfo --namespace=flux-system --url=https://dev.azure.com/foo/bar/_git/podinfo --provider \"\" --branch=test --interval=1m0s --export",
|
||||||
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, please specify the Git provider name, available options are: (generic|azure)"),
|
assert: assertError("invalid argument \"\" for \"--provider\" flag: no source Git provider given, must be one of: generic|azure"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "source with no provider",
|
name: "source with no provider",
|
||||||
|
|
|
||||||
|
|
@ -56,5 +56,5 @@ func (a *CRDsPolicy) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *CRDsPolicy) Description() string {
|
func (a *CRDsPolicy) Description() string {
|
||||||
return fmt.Sprintf("upgrade CRDs policy, available options are: (%s)", a.Type())
|
return "upgrade CRDs policy"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,5 +50,5 @@ func (d *DecryptionProvider) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DecryptionProvider) Description() string {
|
func (d *DecryptionProvider) Description() string {
|
||||||
return fmt.Sprintf("decryption provider, available options are: (%s)", d.Type())
|
return "decryption provider"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func (c *ECDSACurve) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ECDSACurve) Description() string {
|
func (c *ECDSACurve) Description() string {
|
||||||
return fmt.Sprintf("SSH ECDSA public key curve, available options are: (%s)", c.Type())
|
return "SSH ECDSA public key curve"
|
||||||
}
|
}
|
||||||
|
|
||||||
func ecdsaCurves() []string {
|
func ecdsaCurves() []string {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package flags
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/fluxcd/go-git-providers/gitprovider"
|
"github.com/fluxcd/go-git-providers/gitprovider"
|
||||||
|
|
@ -58,16 +59,18 @@ func (d *GitLabVisibility) Set(str string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *GitLabVisibility) Type() string {
|
func (d *GitLabVisibility) Type() string {
|
||||||
|
return strings.Join(gitLabVisibilities(), "|")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *GitLabVisibility) Description() string {
|
||||||
|
return "specifies the visibility of the repository"
|
||||||
|
}
|
||||||
|
|
||||||
|
func gitLabVisibilities() []string {
|
||||||
visibilities := make([]string, 0, len(supportedGitLabVisibilities))
|
visibilities := make([]string, 0, len(supportedGitLabVisibilities))
|
||||||
for visibility := range supportedGitLabVisibilities {
|
for visibility := range supportedGitLabVisibilities {
|
||||||
visibilities = append(visibilities, string(visibility))
|
visibilities = append(visibilities, string(visibility))
|
||||||
}
|
}
|
||||||
return strings.Join(visibilities, "|")
|
sort.Strings(visibilities)
|
||||||
}
|
return visibilities
|
||||||
|
|
||||||
func (d *GitLabVisibility) Description() string {
|
|
||||||
return fmt.Sprintf(
|
|
||||||
"specifies the visibility of the repository, available options are: (%s)",
|
|
||||||
d.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,5 @@ func (s *HelmChartSource) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HelmChartSource) Description() string {
|
func (s *HelmChartSource) Description() string {
|
||||||
return fmt.Sprintf(
|
return "source that contains the chart in the format '<kind>/<name>.<namespace>'"
|
||||||
"source that contains the chart in the format '<kind>/<name>.<namespace>', "+
|
|
||||||
"where kind must be one of: (%s)",
|
|
||||||
s.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,5 @@ func (s *KustomizationSource) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *KustomizationSource) Description() string {
|
func (s *KustomizationSource) Description() string {
|
||||||
return fmt.Sprintf(
|
return "source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', if kind is not specified it defaults to GitRepository"
|
||||||
"source that contains the Kubernetes manifests in the format '[<kind>/]<name>.<namespace>', "+
|
|
||||||
"where kind must be one of: (%s), if kind is not specified it defaults to GitRepository",
|
|
||||||
s.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,5 @@ func (s *LocalHelmChartSource) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LocalHelmChartSource) Description() string {
|
func (s *LocalHelmChartSource) Description() string {
|
||||||
return fmt.Sprintf(
|
return "source that contains the chart in the format '<kind>/<name>'"
|
||||||
"source that contains the chart in the format '<kind>/<name>', "+
|
|
||||||
"where kind must be one of: (%s)",
|
|
||||||
s.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,5 +50,5 @@ func (l *LogLevel) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LogLevel) Description() string {
|
func (l *LogLevel) Description() string {
|
||||||
return fmt.Sprintf("log level, available options are: (%s)", l.Type())
|
return "log level"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,5 +49,5 @@ func (a *PublicKeyAlgorithm) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *PublicKeyAlgorithm) Description() string {
|
func (a *PublicKeyAlgorithm) Description() string {
|
||||||
return fmt.Sprintf("SSH public key algorithm, available options are: (%s)", a.Type())
|
return "SSH public key algorithm"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ func (b *RSAKeyBits) Set(str string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *RSAKeyBits) Type() string {
|
func (b *RSAKeyBits) Type() string {
|
||||||
return "rsaKeyBits"
|
return "int"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *RSAKeyBits) Description() string {
|
func (b *RSAKeyBits) Description() string {
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,5 @@ func (p *SourceBucketProvider) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
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)",
|
|
||||||
p.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ func (p *SourceGitProvider) String() string {
|
||||||
|
|
||||||
func (p *SourceGitProvider) Set(str string) error {
|
func (p *SourceGitProvider) Set(str string) error {
|
||||||
if strings.TrimSpace(str) == "" {
|
if strings.TrimSpace(str) == "" {
|
||||||
return fmt.Errorf("no source Git provider given, please specify %s",
|
return fmt.Errorf("no source Git provider given, must be one of: %s",
|
||||||
p.Description())
|
p.Type())
|
||||||
}
|
}
|
||||||
if !utils.ContainsItemString(supportedSourceGitProviders, str) {
|
if !utils.ContainsItemString(supportedSourceGitProviders, str) {
|
||||||
return fmt.Errorf("source Git provider '%s' is not supported, must be one of: %v",
|
return fmt.Errorf("source Git provider '%s' is not supported, must be one of: %v",
|
||||||
|
|
@ -53,8 +53,5 @@ func (p *SourceGitProvider) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *SourceGitProvider) Description() string {
|
func (p *SourceGitProvider) Description() string {
|
||||||
return fmt.Sprintf(
|
return "the Git provider name"
|
||||||
"the Git provider name, available options are: (%s)",
|
|
||||||
p.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,7 @@ func (p *SourceOCIProvider) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
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)",
|
|
||||||
p.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *SourceOCIProvider) ToOCIProvider() (oci.Provider, error) {
|
func (p *SourceOCIProvider) ToOCIProvider() (oci.Provider, error) {
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,5 @@ func (p *SourceOCIVerifyProvider) Type() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *SourceOCIVerifyProvider) Description() string {
|
func (p *SourceOCIVerifyProvider) Description() string {
|
||||||
return fmt.Sprintf(
|
return "the OCI verify provider name to use for signature verification"
|
||||||
"the OCI verify provider name to use for signature verification, available options are: (%s)",
|
|
||||||
p.Type(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue