MCPcopy Create free account
hub / github.com/cli/cli / printTreeDir

Function printTreeDir

pkg/cmd/skills/install/install.go:1153–1175  ·  view source on GitHub ↗
(w io.Writer, cs *iostreams.ColorScheme, dir, indent string)

Source from the content-addressed store, hash-verified

1151}
1152
1153func printTreeDir(w io.Writer, cs *iostreams.ColorScheme, dir, indent string) {
1154 entries, err := os.ReadDir(dir)
1155 if err != nil {
1156 fmt.Fprintf(w, "%s%s\n", indent, cs.Muted("(could not read directory)"))
1157 return
1158 }
1159 for i, entry := range entries {
1160 isLast := i == len(entries)-1
1161 connector := "├── "
1162 childIndent := "│ "
1163 if isLast {
1164 connector = "└── "
1165 childIndent = " "
1166 }
1167 name := entry.Name()
1168 if entry.IsDir() {
1169 fmt.Fprintf(w, "%s%s%s\n", indent, cs.Muted(connector), cs.Bold(name+"/"))
1170 printTreeDir(w, cs, filepath.Join(dir, name), indent+cs.Muted(childIndent))
1171 } else {
1172 fmt.Fprintf(w, "%s%s%s\n", indent, cs.Muted(connector), name)
1173 }
1174 }
1175}
1176
1177// printPreInstallDisclaimer prints a warning that installed skills are unverified
1178// and should be inspected before use.

Callers 1

printFileTreeFunction · 0.85

Calls 4

MutedMethod · 0.80
BoldMethod · 0.80
JoinMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected