LoadGlobalConfig loads the Host * configuration block Returns (config, found, error)
()
| 8 | // LoadGlobalConfig loads the Host * configuration block |
| 9 | // Returns (config, found, error) |
| 10 | func 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 |
no test coverage detected