MCPcopy Create free account
hub / github.com/MirrowApp/mirrow / formatPath

Function formatPath

packages/cli/src/runner.ts:70–95  ·  view source on GitHub ↗
(target: string)

Source from the content-addressed store, hash-verified

68}
69
70function formatPath(target: string): string {
71 const relative = path.relative(process.cwd(), target);
72
73 if (relative === "") {
74 return ".";
75 }
76
77 if (relative && !relative.startsWith("..") && !path.isAbsolute(relative)) {
78 return relative;
79 }
80
81 const absolute = path.resolve(target);
82 const home = os.homedir();
83 const homeWithSep = home.endsWith(path.sep) ? home : `${home}${path.sep}`;
84
85 if (absolute === home) {
86 return "~";
87 }
88
89 if (absolute.startsWith(homeWithSep)) {
90 const homeRelative = path.relative(home, absolute);
91 return homeRelative ? `~${path.sep}${homeRelative}` : "~";
92 }
93
94 return absolute;
95}
96
97async function processDirectory(
98 inputDir: string,

Callers 3

logActionFunction · 0.85
logRemovalFunction · 0.85
watchMirrowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected