summaryrefslogtreecommitdiff
path: root/flags.go
diff options
context:
space:
mode:
Diffstat (limited to 'flags.go')
-rw-r--r--flags.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/flags.go b/flags.go
index 8241179..e718370 100644
--- a/flags.go
+++ b/flags.go
@@ -6,6 +6,7 @@ import (
)
type MapVar map[string]string
+type SliceVar []string
func (this *MapVar) Set(value string) error {
if *this == nil {
@@ -20,21 +21,21 @@ func (this *MapVar) Set(value string) error {
}
func (this *MapVar) String() string {
- s := ""
+ slice := []string{}
for key, value := range *this {
- s += fmt.Sprintf("%s: %v\n", key, value)
+ slice = append(slice, fmt.Sprintf("%s: %v,", key, value))
}
- return fmt.Sprintf("{%s}", s)
+ return fmt.Sprintf("{%s}", strings.Join(slice, ","))
}
-type SliceVar []string
-
func (this *SliceVar) Set(value string) error {
+ *this = append(*this, value)
+
return nil
}
func (this *SliceVar) String() string {
- return ""
+ return fmt.Sprintf("[%s]", strings.Join(*this, ","))
}