Skip to content

Commit e4547bd

Browse files
authored
Merge pull request #969 from elezar/allow-comma-separated-config-values
Allow nvidia-ctk config --set to accept comma-separated lists
2 parents 63ed478 + d32449b commit e4547bd

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)