diff --git a/doc/devcontainer_cli.txt b/doc/devcontainer-cli.nvim.txt similarity index 95% rename from doc/devcontainer_cli.txt rename to doc/devcontainer-cli.nvim.txt index cfcb71f..2074477 100644 --- a/doc/devcontainer_cli.txt +++ b/doc/devcontainer-cli.nvim.txt @@ -1,3 +1,4 @@ +*devcontainer-cli.nvim.txt* For Neovim >= 0.9 ================================================================================ *devcontainer-cli.nvim* diff --git a/lua/devcontainer_cli/config/init.lua b/lua/devcontainer-cli/config/init.lua similarity index 100% rename from lua/devcontainer_cli/config/init.lua rename to lua/devcontainer-cli/config/init.lua diff --git a/lua/devcontainer_cli/devcontainer_cli.lua b/lua/devcontainer-cli/devcontainer_cli.lua similarity index 92% rename from lua/devcontainer_cli/devcontainer_cli.lua rename to lua/devcontainer-cli/devcontainer_cli.lua index 4f672ad..2aedc47 100644 --- a/lua/devcontainer_cli/devcontainer_cli.lua +++ b/lua/devcontainer-cli/devcontainer_cli.lua @@ -1,5 +1,5 @@ -local config = require("devcontainer_cli.config") -local devcontainer_utils = require("devcontainer_cli.devcontainer_utils") +local config = require("devcontainer-cli.config") +local devcontainer_utils = require("devcontainer-cli.devcontainer_utils") local M = {} diff --git a/lua/devcontainer_cli/devcontainer_utils.lua b/lua/devcontainer-cli/devcontainer_utils.lua similarity index 96% rename from lua/devcontainer_cli/devcontainer_utils.lua rename to lua/devcontainer-cli/devcontainer_utils.lua index 8c8f363..f61b297 100644 --- a/lua/devcontainer_cli/devcontainer_utils.lua +++ b/lua/devcontainer-cli/devcontainer_utils.lua @@ -1,6 +1,6 @@ -local config = require("devcontainer_cli.config") -local windows_utils = require("devcontainer_cli.windows_utils") -local folder_utils = require("devcontainer_cli.folder_utils") +local config = require("devcontainer-cli.config") +local windows_utils = require("devcontainer-cli.windows_utils") +local folder_utils = require("devcontainer-cli.folder_utils") local M = {} diff --git a/lua/devcontainer_cli/folder_utils.lua b/lua/devcontainer-cli/folder_utils.lua similarity index 100% rename from lua/devcontainer_cli/folder_utils.lua rename to lua/devcontainer-cli/folder_utils.lua diff --git a/lua/devcontainer-cli/health.lua b/lua/devcontainer-cli/health.lua new file mode 100644 index 0000000..1584833 --- /dev/null +++ b/lua/devcontainer-cli/health.lua @@ -0,0 +1,30 @@ +local M = {} + +local start = vim.health.start or vim.health.report_start +local ok = vim.health.ok or vim.health.report_ok +local warn = vim.health.warn or vim.health.report_warn +local error = vim.health.error or vim.health.report_error + +local function verify_binary(binary_name) + if vim.fn.executable(binary_name) ~= 1 then + error(("`%s` executable not found."):format(binary_name), ("Install %s"):format(binary_name)) + else + ok(("`%s` executable found."):format(binary_name)) + end +end +-- TODO: create a check for DevcontainerUp, this needs to be done after +-- creating the ability to stop a container +-- TODO: create a check for DevcontainerExec + +function M.check() + -- start("devcontainer-cli") + local required_binaries = { + "docker", + "devcontainer", + } + for _, bin_name in ipairs(required_binaries) do + verify_binary(bin_name) + end +end + +return M diff --git a/lua/devcontainer_cli/init.lua b/lua/devcontainer-cli/init.lua similarity index 87% rename from lua/devcontainer_cli/init.lua rename to lua/devcontainer-cli/init.lua index 86c6b3d..a690231 100644 --- a/lua/devcontainer_cli/init.lua +++ b/lua/devcontainer-cli/init.lua @@ -1,7 +1,7 @@ local M = {} -local devcontainer_cli = require("devcontainer_cli.devcontainer_cli") -local config = require("devcontainer_cli.config") +local devcontainer_cli = require("devcontainer-cli.devcontainer_cli") +local config = require("devcontainer-cli.config") local configured = false -- setup the devcontainer-cli plugin diff --git a/lua/devcontainer_cli/windows_utils.lua b/lua/devcontainer-cli/windows_utils.lua similarity index 97% rename from lua/devcontainer_cli/windows_utils.lua rename to lua/devcontainer-cli/windows_utils.lua index d94a925..485daea 100644 --- a/lua/devcontainer_cli/windows_utils.lua +++ b/lua/devcontainer-cli/windows_utils.lua @@ -1,4 +1,4 @@ -local config = require("devcontainer_cli.config") +local config = require("devcontainer-cli.config") local M = {} diff --git a/lua/devcontainer_cli/health.lua b/lua/devcontainer_cli/health.lua deleted file mode 100644 index 91a482b..0000000 --- a/lua/devcontainer_cli/health.lua +++ /dev/null @@ -1,29 +0,0 @@ -local remote_nvim = require("remote-nvim") -local utils = require("remote-nvim.utils") -local M = {} - -local function verify_binary(binary_name) - local succ, _ = pcall(utils.find_binary, binary_name) - if not succ then - vim.health.error(("`%s` executable not found."):format(binary_name)) - else - vim.health.ok(("`%s` executable found."):format(binary_name)) - end -end --- TODO: create a test that checks that a devcontainer can be brought up, --- this needs to be done after creating the ability to stop a container --- TODO: create a test that checks that a command can be executed within the --- running container - -function M.check() - vim.health.start("devcontainer_cli") - local required_binaries = { - "docker", - "devcontainer-cli", - } - for _, bin_name in ipairs(required_binaries) do - verify_binary(bin_name) - end -end - -return M