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