mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-04-02 12:00:18 +00:00
Merge pull request #969 from elezar/allow-comma-separated-config-values
Some checks are pending
Some checks are pending
Allow nvidia-ctk config --set to accept comma-separated lists
This commit is contained in:
commit
e4547bdda6
@ -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