GetStrict finds the first value for key within a declaration that matches the alias. If key has a default value and no matching configuration is found, the default will be returned. For more information on default values and the way patterns are matched, see the manpage for ssh_config. error will b
(alias, key string)
| 203 | // error will be non-nil if and only if a user's configuration file or the |
| 204 | // system configuration file could not be parsed, and u.IgnoreErrors is false. |
| 205 | func (u *UserSettings) GetStrict(alias, key string) (string, error) { |
| 206 | u.doLoadConfigs() |
| 207 | //lint:ignore S1002 I prefer it this way |
| 208 | if u.onceErr != nil && u.IgnoreErrors == false { |
| 209 | return "", u.onceErr |
| 210 | } |
| 211 | val, err := findVal(u.userConfig, alias, key) |
| 212 | if err != nil || val != "" { |
| 213 | return val, err |
| 214 | } |
| 215 | val2, err2 := findVal(u.systemConfig, alias, key) |
| 216 | if err2 != nil || val2 != "" { |
| 217 | return val2, err2 |
| 218 | } |
| 219 | return Default(key), nil |
| 220 | } |
| 221 | |
| 222 | // GetAllStrict retrieves zero or more directives for key for the given alias. |
| 223 | // If key has a default value and no matching configuration is found, the |
no test coverage detected