(dir string)
| 1131 | } |
| 1132 | |
| 1133 | func friendlyDir(dir string) string { |
| 1134 | if cwd, err := os.Getwd(); err == nil { |
| 1135 | if rel, err := filepath.Rel(cwd, dir); err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) { |
| 1136 | if rel == "." { |
| 1137 | return filepath.Base(dir) |
| 1138 | } |
| 1139 | return rel |
| 1140 | } |
| 1141 | } |
| 1142 | if home, err := os.UserHomeDir(); err == nil { |
| 1143 | if rel, err := filepath.Rel(home, dir); err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) { |
| 1144 | return "~/" + rel |
| 1145 | } |
| 1146 | } |
| 1147 | return dir |
| 1148 | } |
| 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) { |
no test coverage detected