MCPcopy Create free account
hub / github.com/Mister-leo/fssh / readSSHConfigLines

Function readSSHConfigLines

internal/sshconfig/writer.go:192–214  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190}
191
192func readSSHConfigLines() ([]string, error) {
193 configPath := sshConfigPath()
194
195 // Read file
196 content, err := os.ReadFile(configPath)
197 if err != nil {
198 if os.IsNotExist(err) {
199 // Config doesn't exist, return empty
200 return []string{}, nil
201 }
202 return nil, fmt.Errorf("failed to read config: %w", err)
203 }
204
205 // Split into lines
206 lines := strings.Split(string(content), "\n")
207
208 // Remove trailing newline if present (to avoid extra blank line)
209 if len(lines) > 0 && lines[len(lines)-1] == "" {
210 lines = lines[:len(lines)-1]
211 }
212
213 return lines, nil
214}
215
216func writeSSHConfigLines(lines []string) error {
217 configPath := sshConfigPath()

Callers 6

LoadGlobalConfigFunction · 0.85
WriteGlobalConfigFunction · 0.85
WriteHostConfigFunction · 0.85
DeleteHostConfigFunction · 0.85
LoadHostConfigFunction · 0.85
LoadAllHostConfigsFunction · 0.85

Calls 1

sshConfigPathFunction · 0.85

Tested by

no test coverage detected