forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose-ps.ts
38 lines (37 loc) · 890 Bytes
/
compose-ps.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
const getServices: Fig.Generator = {
script: (context) => {
if (context.includes("-f")) {
const index = context.indexOf("-f");
return `docker-compose -f ${context[index + 1]} config --services`;
}
return "docker-compose config --services";
},
splitOn: "\n",
};
export const completionSpec: Fig.Spec = {
name: "ps",
description: "List containers.",
args: [{ generators: getServices }],
options: [
{
name: ["-q", "--quiet"],
description: "Only display IDs",
},
{
name: ["--services"],
description: "Display services",
},
{
name: ["--filter"],
description: "Filter services by a property",
args: {
name: "KEY=VAL",
},
},
{
name: ["-a", "--all"],
description:
"Show all stopped containers (including those created by the run command)",
},
],
};