MCPcopy Index your code
hub / github.com/cli/cli / printTree

Function printTree

pkg/cmd/skills/preview/preview.go:540–556  ·  view source on GitHub ↗
(w io.Writer, cs *iostreams.ColorScheme, nodes []*treeNode, indent string)

Source from the content-addressed store, hash-verified

538}
539
540func printTree(w io.Writer, cs *iostreams.ColorScheme, nodes []*treeNode, indent string) {
541 for i, node := range nodes {
542 isLast := i == len(nodes)-1
543 connector := "├── "
544 childIndent := "│ "
545 if isLast {
546 connector = "└── "
547 childIndent = " "
548 }
549 if node.isDir {
550 fmt.Fprintf(w, "%s%s%s\n", indent, cs.Muted(connector), cs.Bold(node.name+"/"))
551 printTree(w, cs, node.children, indent+cs.Muted(childIndent))
552 } else {
553 fmt.Fprintf(w, "%s%s%s\n", indent, cs.Muted(connector), node.name)
554 }
555 }
556}

Callers 1

renderFileTreeFunction · 0.85

Calls 2

MutedMethod · 0.80
BoldMethod · 0.80

Tested by

no test coverage detected