Skip to content

Commit 337f3c2

Browse files
committed
Add md_prefix and print_path functions
1 parent 34f658b commit 337f3c2

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/script.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,31 @@ function good_filepaths(top_dir = ".") {
3030
})
3131
}
3232

33+
function md_prefix(i) {
34+
if (i) {
35+
let res = ' '.repeat(i);
36+
return res + "*";
37+
} else {
38+
return "\n##"
39+
}
40+
}
41+
42+
function print_path(old_path, new_path) {
43+
let old_parts = old_path.split(path.sep);
44+
let new_parts = new_path.split(path.sep);
45+
for (let i = 0; i < new_parts.length; ++i) {
46+
let new_part = new_parts[i];
47+
if (i + 1 > old_parts.len || old_parts[i] != new_part) {
48+
if (new_part) {
49+
g_output.push(`${md_prefix(i)} ${new_part.replace('_', ' ')}`);
50+
// console.log(`${md_prefix(i)} ${new_part.replace('_', ' ')}`);
51+
}
52+
}
53+
}
54+
return new_path;
55+
}
56+
3357
good_filepaths();
3458
setTimeout(() => {
35-
console.log(filepaths.length);
59+
console.log(filepaths);
3660
}, 1000);

0 commit comments

Comments
 (0)