@@ -24,10 +24,12 @@ package main
2424
2525import (
2626 "context"
27+ "encoding/csv"
2728 "fmt"
2829 "net/url"
2930 "os"
3031 "os/exec"
32+ "strings"
3133 "time"
3234
3335 "github.com/arangodb-helper/arangodb/client"
@@ -76,11 +78,26 @@ func cmdStartRun(cmd *cobra.Command, args []string) {
7678 // Do not pass these along
7779 default :
7880 a := "--" + f .Name
79- value := f .Value .String ()
80- if value != "" {
81- a = a + "=" + value
81+ switch f .Value .Type () {
82+ case "stringSlice" :
83+ values , err := parseStringSlice (f .Value .String ())
84+ if err != nil {
85+ log .Fatal ().Err (err ).
86+ Str ("option" , f .Name ).
87+ Str ("argument" , f .Value .String ()).
88+ Msg ("Failed to parse string-slice argument" )
89+ } else {
90+ for _ , elem := range values {
91+ childArgs = append (childArgs , a + "=" + elem )
92+ }
93+ }
94+ default :
95+ value := f .Value .String ()
96+ if value != "" {
97+ a = a + "=" + value
98+ }
99+ childArgs = append (childArgs , a )
82100 }
83- childArgs = append (childArgs , a )
84101 }
85102 }
86103 })
@@ -153,3 +170,13 @@ func cmdStartRun(cmd *cobra.Command, args []string) {
153170 log .Info ().Msg ("Database instances are available." )
154171 }
155172}
173+
174+ func parseStringSlice (val string ) ([]string , error ) {
175+ if val == "" {
176+ return nil , nil
177+ }
178+ val = val [1 : len (val )- 1 ] // Trim of '[..]'
179+ stringReader := strings .NewReader (val )
180+ csvReader := csv .NewReader (stringReader )
181+ return csvReader .Read ()
182+ }
0 commit comments