-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathkubens.ts
55 lines (55 loc) · 1.24 KB
/
kubens.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
const completionSpec: Fig.Spec = {
name: "kubens",
description: "Switch between Kubernetes-namespaces",
additionalSuggestions: [
{
name: "-",
priority: 85,
description: "Switch to previous namespace within the current context",
icon: "fig://icon?type=asterisk",
},
],
parserDirectives: {
flagsArePosixNoncompliant: true,
},
options: [
{
name: ["--help", "-h"],
description: "Show help for kubens",
},
{
name: ["--current", "-c"],
description: "Show current namespace",
},
],
args: {
name: "namespace",
generators: [
{
script: ["bash", "-c", "kubens | grep -v $(kubens -c)"],
postProcess: (out) =>
out.split("\n").map((item) => ({
name: item,
priority: 90,
icon: "fig://icon?type=kubernetes",
})) as Fig.Suggestion[],
},
{
script: ["kubens", "-c"],
postProcess: (out) => {
return !out
? []
: [
{
name: out,
priority: 100,
icon: "⭐️",
},
];
},
},
],
isOptional: true,
},
};
export default completionSpec;