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