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