(dir string)
| 1111 | } |
| 1112 | |
| 1113 | func friendlyDir(dir string) string { |
| 1114 | if cwd, err := os.Getwd(); err == nil { |
| 1115 | if rel, err := filepath.Rel(cwd, dir); err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) { |
| 1116 | if rel == "." { |
| 1117 | return filepath.Base(dir) |
| 1118 | } |
| 1119 | return rel |
| 1120 | } |
| 1121 | } |
| 1122 | if home, err := os.UserHomeDir(); err == nil { |
| 1123 | if rel, err := filepath.Rel(home, dir); err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) { |
| 1124 | return "~/" + rel |
| 1125 | } |
| 1126 | } |
| 1127 | return dir |
| 1128 | } |
| 1129 | |
| 1130 | // printFileTree renders a text tree of the on-disk contents of each skill directory. |
| 1131 | func printFileTree(w io.Writer, cs *iostreams.ColorScheme, dir string, skillNames []string) { |
no test coverage detected