(key, value string, directives []sshDirective)
| 1019 | } |
| 1020 | |
| 1021 | func updateSSHSingleDirectiveValue(key, value string, directives []sshDirective) error { |
| 1022 | block, err := loadSSHManagedBlockFromFile(sshPath) |
| 1023 | if err != nil { |
| 1024 | return err |
| 1025 | } |
| 1026 | for _, item := range directives { |
| 1027 | if item.InMatch || !strings.EqualFold(item.Key, key) { |
| 1028 | continue |
| 1029 | } |
| 1030 | if item.File == sshPath && block.contains(item.Line) { |
| 1031 | continue |
| 1032 | } |
| 1033 | if err := commentSSHConfigLines(item.File, []int{item.Line}); err != nil { |
| 1034 | return err |
| 1035 | } |
| 1036 | } |
| 1037 | return rewriteSSHManagedDirectives(sshPath, key, []string{fmt.Sprintf("%s %s", key, value)}) |
| 1038 | } |
| 1039 | |
| 1040 | func rewriteSSHMultiValueDirective(key, value string, directives []sshDirective) error { |
| 1041 | block, err := loadSSHManagedBlockFromFile(sshPath) |
no test coverage detected