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 <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2025-03-07 15:52:03 +02:00
parent 6b7ed26fba
commit ef0f97b065
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View File

@ -194,7 +194,14 @@ func setFlagToKeyValue(setFlag string, setListSeparator string) (string, interfa
case reflect.String: case reflect.String:
return key, value, nil return key, value, nil
case reflect.Slice: case reflect.Slice:
valueParts := strings.Split(value, setListSeparator) valueParts := []string{value}
for _, sep := range []string{setListSeparator, ","} {
if !strings.Contains(value, sep) {
continue
}
valueParts = strings.Split(value, sep)
break
}
switch field.Elem().Kind() { switch field.Elem().Kind() {
case reflect.String: case reflect.String:
return key, valueParts, nil return key, valueParts, nil

View File

@ -49,6 +49,7 @@ func main() {
// Create the top-level CLI // Create the top-level CLI
c := cli.NewApp() c := cli.NewApp()
c.DisableSliceFlagSeparator = true
c.Name = "NVIDIA Container Toolkit CLI" c.Name = "NVIDIA Container Toolkit CLI"
c.UseShortOptionHandling = true c.UseShortOptionHandling = true
c.EnableBashCompletion = true c.EnableBashCompletion = true