MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / GetStrict

Method GetStrict

cli/pkg/ssh_config/config.go:205–220  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
205func (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

Callers 2

GetMethod · 0.95
GetStrictFunction · 0.80

Calls 3

doLoadConfigsMethod · 0.95
findValFunction · 0.85
DefaultFunction · 0.85

Tested by

no test coverage detected