forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose-exec.ts
More file actions
63 lines (61 loc) · 1.48 KB
/
compose-exec.ts
File metadata and controls
63 lines (61 loc) · 1.48 KB
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
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",
};
const completionSpec: Fig.Spec = {
name: "exec",
description: "Execute a command in a running container",
args: { generators: getServices },
options: [
{
name: ["-d", "--detach"],
description: "Detached mode: Run command in the background",
},
{
name: "--privileged",
description: "Give extended privileges to the process",
},
{
name: ["-u", "--user"],
description: "Run the command as this user",
args: {
name: "user",
},
},
{
name: "-T",
description:
"Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY",
},
{
name: "--index",
description:
"Index of the container if there are multiple instances of a service [default: 1]",
args: {
name: "index",
},
},
{
name: ["-e", "--env"],
description: "Not supported in API < 1.25)",
args: {
name: "KEY=VAL",
isVariadic: true,
},
},
{
name: ["-w", "--workdir"],
description: "DIR Path to workdir directory for this command",
args: {
name: "DIR PATH",
},
},
],
};
export default completionSpec;