forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
man.ts
27 lines (27 loc) · 743 Bytes
/
man.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export const completionSpec: Fig.Spec = {
name: "man",
description: "format and display the on-line manual pages",
args: {
generators: [
{
/* `man -w` lists all the directories in the manpath */
script:
"ls -1 $(man -w | sed 's#:#/man1 #g') | cut -f 1 -d . | sort | uniq",
postProcess: (out) => {
return out
.split("\n")
.filter((line) => {
return !(line.length == 0 || line.startsWith("/"));
})
.map((line) => {
return {
name: line,
description: "man page",
icon: "fig:https://icon?type=string",
};
});
},
},
],
},
};