printFileTree renders a text tree of the on-disk contents of each skill directory.
(w io.Writer, cs *iostreams.ColorScheme, dir string, skillNames []string)
| 1129 | |
| 1130 | // printFileTree renders a text tree of the on-disk contents of each skill directory. |
| 1131 | func printFileTree(w io.Writer, cs *iostreams.ColorScheme, dir string, skillNames []string) { |
| 1132 | if len(skillNames) == 0 { |
| 1133 | return |
| 1134 | } |
| 1135 | fmt.Fprintln(w) |
| 1136 | for _, name := range skillNames { |
| 1137 | skillDir := filepath.Join(dir, filepath.FromSlash(name)) |
| 1138 | fmt.Fprintf(w, " %s\n", cs.Bold(name+"/")) |
| 1139 | printTreeDir(w, cs, skillDir, " ") |
| 1140 | } |
| 1141 | } |
| 1142 | |
| 1143 | func printTreeDir(w io.Writer, cs *iostreams.ColorScheme, dir, indent string) { |
| 1144 | entries, err := os.ReadDir(dir) |