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

Function printFileTree

pkg/cmd/skills/install/install.go:1145–1155  ·  view source on GitHub ↗

printFileTree renders a text tree of the on-disk contents of each skill directory.

(w io.Writer, cs *iostreams.ColorScheme, dir string, skillNames []string)

Source from the content-addressed store, hash-verified

1143
1144// printFileTree renders a text tree of the on-disk contents of each skill directory.
1145func printFileTree(w io.Writer, cs *iostreams.ColorScheme, dir string, skillNames []string) {
1146 if len(skillNames) == 0 {
1147 return
1148 }
1149 fmt.Fprintln(w)
1150 for _, name := range skillNames {
1151 skillDir := filepath.Join(dir, filepath.FromSlash(name))
1152 fmt.Fprintf(w, " %s\n", cs.Bold(name+"/"))
1153 printTreeDir(w, cs, skillDir, " ")
1154 }
1155}
1156
1157func printTreeDir(w io.Writer, cs *iostreams.ColorScheme, dir, indent string) {
1158 entries, err := os.ReadDir(dir)

Callers 2

installRunFunction · 0.85
runLocalInstallFunction · 0.85

Calls 3

printTreeDirFunction · 0.85
JoinMethod · 0.80
BoldMethod · 0.80

Tested by

no test coverage detected