-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathenv.ts
69 lines (68 loc) · 1.54 KB
/
env.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const enviromentVariables: Fig.Generator = {
custom: async (_tokens, _executeCommand, generatorContext) => {
return Object.values(generatorContext.environmentVariables).map(
(envVar) => ({
name: envVar,
description: "Environment variable",
icon: "🌎",
})
);
},
};
const completionSpec: Fig.Spec = {
name: "env",
description: "Set environment and execute command, or print environment",
options: [
{
name: "-0",
description: "End each output line with NUL, not newline",
},
{
name: ["-i", "-"],
description: "Start with an empty environment",
},
{
name: "-v",
description: "Print verbose logs",
},
{
name: "-u",
description: "Remove variable from the environment",
args: {
name: "name",
generators: enviromentVariables,
},
},
{
name: "-P",
description:
"Search the given directories for the utility, rather than the PATH",
args: {
name: "altpath",
template: "folders",
},
},
{
name: "-S",
description: "Split the given string into separate arguments",
args: {
name: "string",
},
},
],
// Only uncomment if env takes an argument
args: [
{
name: "name=value ...",
description: "Set environment variables",
isOptional: true,
},
{
name: "utility",
description: "Utility to run",
isOptional: true,
isCommand: true,
},
],
};
export default completionSpec;