diff --git a/lua/coverage/config.lua b/lua/coverage/config.lua index 7bc7504..8c282da 100644 --- a/lua/coverage/config.lua +++ b/lua/coverage/config.lua @@ -153,6 +153,9 @@ local defaults = { php = { coverage_file = "coverage/cobertura.xml", path_mappings = {}, + }, + sh = { + coverage_file = "coverage/lcov.info", } }, lcov_file = nil, diff --git a/lua/coverage/languages/sh.lua b/lua/coverage/languages/sh.lua new file mode 100644 index 0000000..312cd41 --- /dev/null +++ b/lua/coverage/languages/sh.lua @@ -0,0 +1,27 @@ +local M = {} + +local Path = require("plenary.path") +local common = require("coverage.languages.common") +local config = require("coverage.config") +local util = require("coverage.util") + +--- Returns a list of signs to be placed. +M.sign_list = common.sign_list + +--- Returns a summary report. +M.summary = common.summary + +--- Loads a coverage report. +-- @param callback called with the results of the coverage report +M.load = function(callback) + local sh_config = config.opts.lang.sh + local p = Path:new(util.get_coverage_file(sh_config.coverage_file)) + if not p:exists() then + vim.notify("No coverage file exists.", vim.log.levels.INFO) + return + end + + callback(util.lcov_to_table(p)) +end + +return M