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

Function LoadHostConfig

internal/sshconfig/writer.go:113–125  ·  view source on GitHub ↗

LoadHostConfig loads a specific host configuration

(hostName string)

Source from the content-addressed store, hash-verified

111
112// LoadHostConfig loads a specific host configuration
113func LoadHostConfig(hostName string) (*HostConfig, error) {
114 lines, err := readSSHConfigLines()
115 if err != nil {
116 return nil, err
117 }
118
119 start, end, found := findHostBlock(lines, hostName)
120 if !found {
121 return nil, fmt.Errorf("host %s not found", hostName)
122 }
123
124 return parseHostBlock(lines, start, end)
125}
126
127// LoadAllHostConfigs loads all host configurations
128func LoadAllHostConfigs() (map[string]*HostConfig, error) {

Callers 4

cmdEditFunction · 0.92
cmdDeleteFunction · 0.92
cmdShowFunction · 0.92
cmdInfoFunction · 0.92

Calls 3

readSSHConfigLinesFunction · 0.85
findHostBlockFunction · 0.85
parseHostBlockFunction · 0.85

Tested by

no test coverage detected