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

Method Matches

cli/pkg/ssh_config/config.go:519–536  ·  view source on GitHub ↗

Matches returns true if the Host matches for the given alias. For a description of the rules that provide a match, see the manpage for ssh_config.

(alias string)

Source from the content-addressed store, hash-verified

517// a description of the rules that provide a match, see the manpage for
518// ssh_config.
519func (h *Host) Matches(alias string) bool {
520 found := false
521 for i := range h.Patterns {
522 if h.Patterns[i].regex.MatchString(alias) {
523 if h.Patterns[i].not {
524 // Negated match. "A pattern entry may be negated by prefixing
525 // it with an exclamation mark (`!'). If a negated entry is
526 // matched, then the Host entry is ignored, regardless of
527 // whether any other patterns on the line match. Negated matches
528 // are therefore useful to provide exceptions for wildcard
529 // matches."
530 return false
531 }
532 found = true
533 }
534 }
535 return found
536}
537
538// String prints h as it would appear in a config file. Minor tweaks may be
539// present in the whitespace in the printed file.

Callers 2

GetMethod · 0.80
GetAllMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected