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

Function printTreeDir

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

Source from the content-addressed store, hash-verified

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

Callers 1

printFileTreeFunction · 0.85

Calls 7

NewUntrustedFunction · 0.92
MutedMethod · 0.80
IsDirMethod · 0.80
BoldMethod · 0.80
JoinMethod · 0.80
NameMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected