Skip to content

Commit d32449b

Browse files
committed
Allow nvidia-ctk config --set to accept comma-separated lists
The urfave update to v2.27.6 fixes the behaviour when disabling a separator for repeated StringSliceFlags. This change updates the nvidia-ctk config command to allow list options to be specified as comma-separated values. Signed-off-by: Evan Lezar <[email protected]>
1 parent 63ed478 commit d32449b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cmd/nvidia-ctk/config/config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,14 @@ func setFlagToKeyValue(setFlag string, setListSeparator string) (string, interfa
194194
case reflect.String:
195195
return key, value, nil
196196
case reflect.Slice:
197-
valueParts := strings.Split(value, setListSeparator)
197+
valueParts := []string{value}
198+
for _, sep := range []string{setListSeparator, ","} {
199+
if !strings.Contains(value, sep) {
200+
continue
201+
}
202+
valueParts = strings.Split(value, sep)
203+
break
204+
}
198205
switch field.Elem().Kind() {
199206
case reflect.String:
200207
return key, valueParts, nil

cmd/nvidia-ctk/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func main() {
4949

5050
// Create the top-level CLI
5151
c := cli.NewApp()
52+
c.DisableSliceFlagSeparator = true
5253
c.Name = "NVIDIA Container Toolkit CLI"
5354
c.UseShortOptionHandling = true
5455
c.EnableBashCompletion = true

0 commit comments

Comments
 (0)