add a ui (wip)

This commit is contained in:
2025-07-01 21:44:43 -04:00
parent fa3457e463
commit 44ec0633ce
5 changed files with 341 additions and 21 deletions

View File

@ -5,6 +5,7 @@ local packager = require("dep.package")
local modules = require("dep.modules")
local bench = require("dep.bench")
local lazy = require("dep.lazy")
local ui = require("dep.ui")
-- all functions for convenience
local M = {}
@ -143,25 +144,6 @@ return function(opts)
end
-- add some user commands
vim.api.nvim_create_user_command("DepLog", function()
vim.cmd('vsp '..logger.path)
vim.opt_local.readonly = true
-- make the log auto update while it's open
local w = h.uv.new_fs_event()
local function watch_file(fname)
local fullpath = vim.api.nvim_call_function(
'fnamemodify', { fname, ':p' })
w:start(fullpath, {}, vim.schedule_wrap(function(...)
vim.cmd('checktime')
w:stop()
watch_file(fname)
end))
end
watch_file(logger.path)
end, {})
vim.api.nvim_create_user_command("DepSync", function()
synctree(packager.get_packages())
end, {})
@ -177,5 +159,15 @@ return function(opts)
fs:clean(packager)
end, {})
vim.api.nvim_create_user_command("DepUi", function()
ui.open(packager)
ui.set_page("P")
end, {})
vim.api.nvim_create_user_command("DepLog", function()
ui.open(packager)
ui.set_page("L")
end, {})
logger:cleanup()
end