MCPcopy Create free account
hub / github.com/Mister-leo/fssh / hasHostBlock

Function hasHostBlock

cmd/fssh/config_gen.go:65–75  ·  view source on GitHub ↗
(content, host string)

Source from the content-addressed store, hash-verified

63}
64
65func hasHostBlock(content, host string) bool {
66 s := bufio.NewScanner(strings.NewReader(content))
67 for s.Scan() {
68 line := strings.TrimSpace(s.Text())
69 if strings.HasPrefix(strings.ToLower(line), "host ") {
70 parts := strings.Fields(line[5:])
71 for _, h := range parts { if h == host { return true } }
72 }
73 }
74 return false
75}
76
77func replaceHostBlock(content, host, block string) string {
78 lines := strings.Split(content, "\n")

Callers 1

cmdConfigGenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected