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

Method String

cli/pkg/ssh_config/config.go:540–569  ·  view source on GitHub ↗

String prints h as it would appear in a config file. Minor tweaks may be present in the whitespace in the printed file.

()

Source from the content-addressed store, hash-verified

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.
540func (h *Host) String() string {
541 var buf strings.Builder
542 //lint:ignore S1002 I prefer to write it this way
543 if h.implicit == false {
544 buf.WriteString(strings.Repeat(" ", int(h.leadingSpace)))
545 buf.WriteString("Host")
546 if h.hasEquals {
547 buf.WriteString(" = ")
548 } else {
549 buf.WriteString(" ")
550 }
551 for i, pat := range h.Patterns {
552 buf.WriteString(pat.String())
553 if i < len(h.Patterns)-1 {
554 buf.WriteString(" ")
555 }
556 }
557 buf.WriteString(h.spaceBeforeComment)
558 if h.EOLComment != "" {
559 buf.WriteByte('#')
560 buf.WriteString(h.EOLComment)
561 }
562 buf.WriteByte('\n')
563 }
564 for i := range h.Nodes {
565 buf.WriteString(h.Nodes[i].String())
566 buf.WriteByte('\n')
567 }
568 return buf.String()
569}
570
571// Node represents a line in a Config.
572type Node interface {

Callers

nothing calls this directly

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected