--- Personal lua config files for NeoVim. -- Last Changed: 2023-02-08 -- Author: Federico Igne -- 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 } }