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
|
--- Personal lua config files for NeoVim.
-- Last Changed: 2023-02-08
-- Author: Federico Igne <git@federicoigne.com>
-- License: This file is placed in the public domain.
local function docker_compose_up(module_config, _)
local up = { module_config.cmd, "compose" }
if module_config.args and module_config.args.up then
for _,s in ipairs(module_config.args.up) do
table.insert(up,"--file")
table.insert(up,s)
end
end
table.insert(up,"up")
return {
cmd = "true",
ignore_stdout = true,
ignore_stderr = true,
after_success = function()
require"dyamon".terminal.toggle({
cmd = up,
win = { border = "rounded" }
})
end
}
end
local function docker_compose_down(module_config, _)
local down = { "compose" }
-- Technically speaking only the first configuration file is needed
-- to deduce the cwd.
if module_config.args and module_config.args.up then
for _,s in ipairs(module_config.args.up) do
table.insert(down,"--file")
table.insert(down,s)
end
end
table.insert(down,"down")
return {
cmd = module_config.cmd,
args = down
}
end
return {
params = { 'cmd' },
--condition = function() return true end,
tasks = {
up = docker_compose_up,
down = docker_compose_down
}
}
|