Skip to content

Commit a62abb0

Browse files
committed
refactor: remove unused utils functions
1 parent 1f7c9e5 commit a62abb0

1 file changed

Lines changed: 0 additions & 68 deletions

File tree

lua/gitlab/utils/init.lua

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ M.filter = function(input_table, value_to_remove)
5959
return resultTable
6060
end
6161

62-
M.filter_by_key_value = function(input_table, target_key, target_value)
63-
local result_table = {}
64-
for _, v in ipairs(input_table) do
65-
if v[target_key] ~= target_value then
66-
table.insert(result_table, v)
67-
end
68-
end
69-
end
70-
7162
---Merges two deeply nested tables together, overriding values from the first with conflicts
7263
---@param defaults table The first table
7364
---@param overrides table The second table
@@ -324,13 +315,6 @@ M.map = function(tbl, f)
324315
return t
325316
end
326317

327-
M.reduce = function(tbl, agg, f)
328-
for _, v in pairs(tbl) do
329-
agg = f(agg, v)
330-
end
331-
return agg
332-
end
333-
334318
M.notify = function(msg, lvl)
335319
vim.notify("gitlab.nvim: " .. msg, lvl)
336320
end
@@ -340,10 +324,6 @@ M.notify_vim_error = function(msg, lvl)
340324
M.notify(msg:gsub("^Vim:", ""):gsub("^gitlab.nvim: ", ""), lvl)
341325
end
342326

343-
M.get_current_line_number = function()
344-
return vim.api.nvim_call_function("line", { "." })
345-
end
346-
347327
M.is_windows = function()
348328
if vim.fn.has("win32") == 1 or vim.fn.has("win32unix") == 1 then
349329
return true
@@ -424,14 +404,6 @@ M.toggle_string_bool = function(bool)
424404
return toggled
425405
end
426406

427-
M.string_starts = function(str, start)
428-
return str:sub(1, #start) == start
429-
end
430-
431-
M.press_enter = function()
432-
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", false, true, true), "n", false)
433-
end
434-
435407
M.press_escape = function()
436408
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", false, true, true), "nx", false)
437409
end
@@ -443,36 +415,6 @@ M.from_iso_format_date_to_timestamp = function(date_string)
443415
local year, month, day, hour, min, sec = date_string:match("(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)")
444416
return os.time({ year = year, month = month, day = day, hour = hour, min = min, sec = sec })
445417
end
446-
447-
M.format_date = function(date_string)
448-
local date_table = os.date("!*t")
449-
local date = M.from_iso_format_date_to_timestamp(date_string)
450-
451-
local current_date = os.time({
452-
year = date_table.year,
453-
month = date_table.month,
454-
day = date_table.day,
455-
hour = date_table.hour,
456-
min = date_table.min,
457-
sec = date_table.sec,
458-
})
459-
460-
local time_diff = current_date - date
461-
462-
if time_diff < 60 then
463-
return M.pluralize(time_diff, "second")
464-
elseif time_diff < 3600 then
465-
return M.pluralize(math.floor(time_diff / 60), "minute")
466-
elseif time_diff < 86400 then
467-
return M.pluralize(math.floor(time_diff / 3600), "hour")
468-
elseif time_diff < 2592000 then
469-
return M.pluralize(math.floor(time_diff / 86400), "day")
470-
else
471-
local formatted_date = os.date("%A, %B %e", date)
472-
return formatted_date
473-
end
474-
end
475-
476418
M.difference = function(a, b)
477419
local set_b = {}
478420
for _, val in ipairs(b) do
@@ -510,16 +452,6 @@ M.get_root_path = function()
510452
return vim.fn.fnamemodify(path, ":p:h:h:h:h")
511453
end
512454

513-
M.remove_last_chunk = function(sentence)
514-
local words = {}
515-
for word in sentence:gmatch("%S+") do
516-
table.insert(words, word)
517-
end
518-
table.remove(words, #words)
519-
local sentence_without_last = table.concat(words, " ")
520-
return sentence_without_last
521-
end
522-
523455
M.get_line_content = function(bufnr, start)
524456
local current_buffer = vim.api.nvim_get_current_buf()
525457
local lines = vim.api.nvim_buf_get_lines(bufnr ~= nil and bufnr or current_buffer, start - 1, start, false)

0 commit comments

Comments
 (0)