-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathecho.ts
42 lines (40 loc) · 1007 Bytes
/
echo.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const environmentVariableGenerator: Fig.Generator = {
custom: async (tokens, _, context) => {
if (tokens.length < 3 || tokens[tokens.length - 1].startsWith("$")) {
return Object.keys(context.environmentVariables).map((suggestion) => ({
name: `$${suggestion}`,
type: "arg",
description: "Environment Variable",
}));
} else {
return [];
}
},
trigger: "$",
};
const completionSpec: Fig.Spec = {
name: "echo",
description: "Write arguments to the standard output",
args: {
name: "string",
isVariadic: true,
optionsCanBreakVariadicArg: false,
suggestCurrentToken: true,
generators: environmentVariableGenerator,
},
options: [
{
name: "-n",
description: "Do not print the trailing newline character",
},
{
name: "-e",
description: "Interpret escape sequences",
},
{
name: "-E",
description: "Disable escape sequences",
},
],
};
export default completionSpec;