(dir string)
| 1124 | } |
| 1125 | |
| 1126 | func friendlyDir(dir string) string { |
| 1127 | if cwd, err := os.Getwd(); err == nil { |
| 1128 | if rel, err := filepath.Rel(cwd, dir); err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) { |
| 1129 | if rel == "." { |
| 1130 | return filepath.Base(dir) |
| 1131 | } |
| 1132 | return rel |
| 1133 | } |
| 1134 | } |
| 1135 | if home, err := os.UserHomeDir(); err == nil { |
| 1136 | if rel, err := filepath.Rel(home, dir); err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) { |
| 1137 | return "~/" + rel |
| 1138 | } |
| 1139 | } |
| 1140 | return dir |
| 1141 | } |
| 1142 | |
| 1143 | // printFileTree renders a text tree of the on-disk contents of each skill directory. |
| 1144 | func printFileTree(w io.Writer, cs *iostreams.ColorScheme, dir string, skillNames []string) { |
no test coverage detected