MCPcopy Create free account
hub / github.com/cli/cli / friendlyDir

Function friendlyDir

pkg/cmd/skills/install/install.go:1113–1128  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

1111}
1112
1113func 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.
1131func printFileTree(w io.Writer, cs *iostreams.ColorScheme, dir string, skillNames []string) {

Callers 3

installRunFunction · 0.85
runLocalInstallFunction · 0.85
buildInstallPlansFunction · 0.85

Calls 1

BaseMethod · 0.80

Tested by

no test coverage detected