1
0
mirror of synced 2026-02-13 13:06:56 +00:00

Add tests for CLI flags

This includes various bug fixes, especially around the area of missing
names for `<kind>/<name>` formats.

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals
2020-12-14 16:11:46 +01:00
parent 3c1793b6c5
commit 996bfe87ff
20 changed files with 526 additions and 54 deletions

View File

@@ -28,29 +28,28 @@ var supportedSourceBucketProviders = []string{sourcev1.GenericBucketProvider, so
type SourceBucketProvider string
func (s *SourceBucketProvider) String() string {
return string(*s)
func (p *SourceBucketProvider) String() string {
return string(*p)
}
func (s *SourceBucketProvider) Set(str string) error {
func (p *SourceBucketProvider) Set(str string) error {
if strings.TrimSpace(str) == "" {
return fmt.Errorf("no source bucket provider given, please specify %s",
s.Description())
p.Description())
}
if !utils.ContainsItemString(supportedSourceBucketProviders, str) {
return fmt.Errorf("source bucket provider '%s' is not supported, can be one of: %v",
return fmt.Errorf("source bucket provider '%s' is not supported, must be one of: %v",
str, strings.Join(supportedSourceBucketProviders, ", "))
}
*p = SourceBucketProvider(str)
return nil
}
func (s *SourceBucketProvider) Type() string {
func (p *SourceBucketProvider) Type() string {
return "sourceBucketProvider"
}
func (s *SourceBucketProvider) Description() string {
func (p *SourceBucketProvider) Description() string {
return fmt.Sprintf(
"the S3 compatible storage provider name, available options are: (%s)",
strings.Join(supportedSourceBucketProviders, ", "),