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

Method GetAllStrict

cli/pkg/ssh_config/config.go:230–249  ·  view source on GitHub ↗

GetAllStrict retrieves zero or more directives for key for the given 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. The returned error wi

(alias, key string)

Source from the content-addressed store, hash-verified

228// or the system configuration file could not be parsed, and u.IgnoreErrors is
229// false.
230func (u *UserSettings) GetAllStrict(alias, key string) ([]string, error) {
231 u.doLoadConfigs()
232 //lint:ignore S1002 I prefer it this way
233 if u.onceErr != nil && u.IgnoreErrors == false {
234 return nil, u.onceErr
235 }
236 val, err := findAll(u.userConfig, alias, key)
237 if err != nil || val != nil {
238 return val, err
239 }
240 val2, err2 := findAll(u.systemConfig, alias, key)
241 if err2 != nil || val2 != nil {
242 return val2, err2
243 }
244 // TODO: IdentityFile has multiple default values that we should return.
245 if def := Default(key); def != "" {
246 return []string{def}, nil
247 }
248 return []string{}, nil
249}
250
251func (u *UserSettings) doLoadConfigs() {
252 u.loadConfigs.Do(func() {

Callers 2

GetAllMethod · 0.95
GetAllStrictFunction · 0.80

Calls 3

doLoadConfigsMethod · 0.95
findAllFunction · 0.85
DefaultFunction · 0.85

Tested by

no test coverage detected