(w io.Writer, cs *iostreams.ColorScheme, dir, indent string)
| 1151 | } |
| 1152 | |
| 1153 | func printTreeDir(w io.Writer, cs *iostreams.ColorScheme, dir, indent string) { |
| 1154 | entries, err := os.ReadDir(dir) |
| 1155 | if err != nil { |
| 1156 | fmt.Fprintf(w, "%s%s\n", indent, cs.Muted("(could not read directory)")) |
| 1157 | return |
| 1158 | } |
| 1159 | for i, entry := range entries { |
| 1160 | isLast := i == len(entries)-1 |
| 1161 | connector := "├── " |
| 1162 | childIndent := "│ " |
| 1163 | if isLast { |
| 1164 | connector = "└── " |
| 1165 | childIndent = " " |
| 1166 | } |
| 1167 | name := entry.Name() |
| 1168 | if entry.IsDir() { |
| 1169 | fmt.Fprintf(w, "%s%s%s\n", indent, cs.Muted(connector), cs.Bold(name+"/")) |
| 1170 | printTreeDir(w, cs, filepath.Join(dir, name), indent+cs.Muted(childIndent)) |
| 1171 | } else { |
| 1172 | fmt.Fprintf(w, "%s%s%s\n", indent, cs.Muted(connector), name) |
| 1173 | } |
| 1174 | } |
| 1175 | } |
| 1176 | |
| 1177 | // printPreInstallDisclaimer prints a warning that installed skills are unverified |
| 1178 | // and should be inspected before use. |
no test coverage detected