-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #462 from drone-plugins/CI-14845
fix:[CI-14845]: support for build args which has comma seperated values
- Loading branch information
Showing
3 changed files
with
124 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
// CustomStringSliceFlag is like a regular StringSlice flag but with | ||
// semicolon as a delimiter | ||
type CustomStringSliceFlag struct { | ||
Value []string | ||
} | ||
|
||
func (f *CustomStringSliceFlag) GetValue() []string { | ||
if f.Value == nil { | ||
return make([]string, 0) | ||
} | ||
return f.Value | ||
} | ||
|
||
func (f *CustomStringSliceFlag) String() string { | ||
if f.Value == nil { | ||
return "" | ||
} | ||
return strings.Join(f.Value, ";") | ||
} | ||
|
||
func (f *CustomStringSliceFlag) Set(v string) error { | ||
for _, s := range strings.Split(v, ";") { | ||
s = strings.TrimSpace(s) | ||
f.Value = append(f.Value, s) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters