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

Function printTreeDir

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

Source from the content-addressed store, hash-verified

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

Callers 1

printFileTreeFunction · 0.85

Calls 5

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

Tested by

no test coverage detected