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

Function LoadGlobalConfig

internal/sshconfig/global.go:10–28  ·  view source on GitHub ↗

LoadGlobalConfig loads the Host * configuration block Returns (config, found, error)

()

Source from the content-addressed store, hash-verified

8// LoadGlobalConfig loads the Host * configuration block
9// Returns (config, found, error)
10func LoadGlobalConfig() (*HostConfig, bool, error) {
11 lines, err := readSSHConfigLines()
12 if err != nil {
13 return nil, false, err
14 }
15
16 start, end, found := findHostBlock(lines, "*")
17 if !found {
18 return nil, false, nil
19 }
20
21 cfg, err := parseHostBlock(lines, start, end)
22 if err != nil {
23 return nil, false, err
24 }
25
26 cfg.IsGlobal = true
27 return cfg, true, nil
28}
29
30// WriteGlobalConfig writes or updates the Host * configuration
31// Creates the block at the END of config file if it doesn't exist

Callers 4

cmdGlobalShowFunction · 0.92
cmdGlobalEditFunction · 0.92
SetGlobalOptionFunction · 0.85
UnsetGlobalOptionFunction · 0.85

Calls 3

readSSHConfigLinesFunction · 0.85
findHostBlockFunction · 0.85
parseHostBlockFunction · 0.85

Tested by

no test coverage detected