Feat: View + Manage Pipeline (#53)

This MR adds the `.pipeline()` command which opens up the pipeline popup. This popup shows information about the current pipeline and it's jobs, and gives users the ability to re-trigger failed jobs.
This commit is contained in:
Harrison (Harry) Cramer
2023-09-03 18:01:54 -04:00
committed by GitHub
parent 4c6dcacfcd
commit e6e0bf4093
15 changed files with 267 additions and 8 deletions

View File

@@ -49,14 +49,18 @@ M.format_date = function(date_string)
local time_diff = current_date - date
local function pluralize(num, word)
return num .. string.format(" %s", word) .. (num > 1 and "s" or '') .. " ago"
end
if time_diff < 60 then
return time_diff .. " seconds ago"
return pluralize(time_diff, "second")
elseif time_diff < 3600 then
return math.floor(time_diff / 60) .. " minutes ago"
return pluralize(math.floor(time_diff / 60), "minute")
elseif time_diff < 86400 then
return math.floor(time_diff / 3600) .. " hours ago"
return pluralize(math.floor(time_diff / 3600), "hour")
elseif time_diff < 2592000 then
return math.floor(time_diff / 86400) .. " days ago"
return pluralize(math.floor(time_diff / 86400), "day")
else
local formatted_date = os.date("%A, %B %e", date)
return formatted_date
@@ -254,4 +258,17 @@ M.get_win_from_buf = function(bufnr)
end
end
M.switch_can_edit_buf = function(buf, bool)
vim.api.nvim_buf_set_option(buf, 'modifiable', bool)
vim.api.nvim_buf_set_option(buf, "readonly", not bool)
end
M.reverse = function(list)
local rev = {}
for i = #list, 1, -1 do
rev[#rev + 1] = list[i]
end
return rev
end
return M