diff --git a/lua/gitlab/utils/init.lua b/lua/gitlab/utils/init.lua index 1d597ca2..fcc4775e 100644 --- a/lua/gitlab/utils/init.lua +++ b/lua/gitlab/utils/init.lua @@ -126,21 +126,6 @@ M.time_since = function(date_string, current_date_table) end end ----Removes the first value from a list and returns the new, smaller list ----@param tbl table The table ----@return table -M.remove_first_value = function(tbl) - local sliced_list = {} - if M.table_size(tbl) <= 1 then - return sliced_list - end - for i = 2, #tbl do - table.insert(sliced_list, tbl[i]) - end - - return sliced_list -end - ---Spreads all the values from t2 into t1 ---@param t1 table The first table (gets the values) ---@param t2 table The second table @@ -176,14 +161,6 @@ M.contains = function(list, search_value) return false end ----Trims whitespace from a string ----@param s string The string to trim ----@return string -M.trim = function(s) - local res = s:gsub("^%s+", ""):gsub("%s+$", "") - return res -end - ---Splits a string by new lines and returns an iterator ---@param s string The string to split ---@return table: An iterator object @@ -556,10 +533,6 @@ M.get_lines = function(start_line, end_line) return vim.api.nvim_buf_get_lines(0, start_line - 1, end_line, false) end -M.make_comma_separated_readable = function(str) - return string.gsub(str, ",", ", ") -end - ---Select a git branch and perform callback with the branch as an argument ---@param cb function The callback to perform with the selected branch M.select_target_branch = function(cb) @@ -576,11 +549,6 @@ M.select_target_branch = function(cb) end) end -M.basename = function(str) - local name = string.gsub(str, "(.*/)(.*)", "%2") - return name -end - M.get_web_url = function() local web_url = require("gitlab.state").INFO.web_url if web_url ~= nil then diff --git a/tests/spec/util_spec.lua b/tests/spec/util_spec.lua index 0a569a79..8ef8c8a1 100644 --- a/tests/spec/util_spec.lua +++ b/tests/spec/util_spec.lua @@ -86,42 +86,6 @@ describe("utils/init.lua", function() end) end) - describe("remove_first_value", function() - it("Removes the first value correctly", function() - local got = u.remove_first_value({ 1, 2 }) - local want = { 2 } - assert.are.same(want, got) - end) - it("Handles a one-length list", function() - local got = u.remove_first_value({ 1 }) - local want = {} - assert.are.same(want, got) - end) - it("Handles a zero-length list", function() - local got = u.remove_first_value({}) - local want = {} - assert.are.same(want, got) - end) - end) - - describe("table_size", function() - it("Works for associative tables", function() - local got = u.remove_first_value({ 1, 2 }) - local want = { 2 } - assert.are.same(want, got) - end) - it("Handles a one-length list", function() - local got = u.remove_first_value({ 1 }) - local want = {} - assert.are.same(want, got) - end) - it("Handles a zero-length list", function() - local got = u.remove_first_value({}) - local want = {} - assert.are.same(want, got) - end) - end) - describe("contains", function() it("Finds a value in a list", function() local got = u.contains({ 1, 2 }, 1)