feat: add file size in popup (#1049)

This commit is contained in:
Andreas Bissinger
2022-03-06 11:26:35 +01:00
committed by GitHub
parent 5015e7226c
commit ceadf83809
4 changed files with 36 additions and 20 deletions

View File

@@ -5,16 +5,6 @@ local M = {
is_windows = vim.fn.has('win32') == 1
}
local function get_last_modified(absolute_path)
local stat = uv.fs_stat(absolute_path)
local last_modified = 0
if stat ~= nil then
last_modified = stat.mtime.sec
end
return last_modified
end
function M.get_dir_git_status(parent_ignored, status, absolute_path)
if parent_ignored then
return '!!'
@@ -40,7 +30,7 @@ function M.folder(absolute_path, name, status, parent_ignored)
name = name,
nodes = {},
open = false,
last_modified = get_last_modified(absolute_path),
fs_stat = uv.fs_stat(absolute_path),
}
end
@@ -60,7 +50,7 @@ function M.file(absolute_path, name, status, parent_ignored)
extension = ext,
git_status = M.get_git_status(parent_ignored, status, absolute_path),
name = name,
last_modified = get_last_modified(absolute_path),
fs_stat = uv.fs_stat(absolute_path),
}
end
@@ -82,11 +72,11 @@ function M.link(absolute_path, name, status, parent_ignored)
absolute_path = absolute_path,
git_status = M.get_git_status(parent_ignored, status, absolute_path),
group_next = nil, -- If node is grouped, this points to the next child dir/link node
last_modified = get_last_modified(absolute_path),
link_to = link_to,
name = name,
nodes = nodes,
open = open,
fs_stat = uv.fs_stat(absolute_path),
}
end