mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-03-09 13:50:22 +00:00
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:
parent
6b7ed26fba
commit
ef0f97b065
@ -194,7 +194,14 @@ func setFlagToKeyValue(setFlag string, setListSeparator string) (string, interfa
|
||||
case reflect.String:
|
||||
return key, value, nil
|
||||
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() {
|
||||
case reflect.String:
|
||||
return key, valueParts, nil
|
||||
|
@ -49,6 +49,7 @@ func main() {
|
||||
|
||||
// Create the top-level CLI
|
||||
c := cli.NewApp()
|
||||
c.DisableSliceFlagSeparator = true
|
||||
c.Name = "NVIDIA Container Toolkit CLI"
|
||||
c.UseShortOptionHandling = true
|
||||
c.EnableBashCompletion = true
|
||||
|
Loading…
Reference in New Issue
Block a user