Skip to content

Commit 56a54e7

Browse files
committed
improv(wezterm): make display of entries consistent with wezterm docs
1 parent ae99e02 commit 56a54e7

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

scripts/manual-docs-searches/wezterm-docs-search.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ app.includeStandardAdditions = true;
66

77
/** @param {string} str */
88
function alfredMatcher(str) {
9-
const clean = str.replace(/[-()_.:#/\\;,[\]]/g, " ");
10-
const camelCaseSeparated = str.replace(/([A-Z])/g, " $1");
11-
return [clean, camelCaseSeparated, str].join(" ");
9+
const clean = str.replace(/[-_]/g, " ");
10+
return [clean, str].join(" ");
1211
}
1312

1413
//──────────────────────────────────────────────────────────────────────────────
@@ -23,23 +22,22 @@ function run() {
2322
.tree.filter((/** @type {{ path: string; }} */ file) => docPathRegex.test(file.path))
2423
.reverse()
2524
.map((/** @type {{ path: string }} */ entry) => {
26-
const title = entry.path.slice(5, -3);
27-
const parts = title.split("/");
28-
let displayTitle = (parts.pop() || "??").replace(/[-_]/g, " ");
29-
displayTitle = displayTitle.charAt(0).toUpperCase() + displayTitle.slice(1);
25+
const entryPath = entry.path.slice(5, -3);
26+
const parts = entryPath.split("/");
27+
const title = parts.pop() || "??";
3028
const category = parts.join("/");
31-
const url = `${baseURL}/${title}`;
29+
const url = `${baseURL}/${entryPath}`;
3230

3331
return {
34-
title: displayTitle,
32+
title: title,
3533
subtitle: category,
36-
match: alfredMatcher(title),
34+
match: alfredMatcher(entryPath),
3735
mods: {
38-
cmd: { arg: title }, // copy entry
36+
cmd: { arg: entryPath }, // copy entry
3937
},
4038
arg: url,
4139
quicklookurl: url,
42-
uid: title,
40+
uid: entryPath,
4341
};
4442
});
4543

0 commit comments

Comments
 (0)