more docs

This commit is contained in:
Barrett Ruth 2025-10-01 21:36:53 -04:00
parent 7eb314b02c
commit 6b8a1e2087
10 changed files with 83 additions and 142 deletions

View file

@ -7,7 +7,16 @@ local logger = require('cp.log')
local platforms = constants.PLATFORMS
function M.handle_cache_command(cmd)
if cmd.subcommand == 'clear' then
if cmd.subcommand == 'read' then
local data = cache.get_data_pretty()
local buf = vim.api.nvim_create_buf(true, true)
vim.api.nvim_buf_set_name(buf, 'cp.nvim://cache.lua')
vim.api.nvim_buf_set_lines(buf, 0, -1, false, vim.split(data, '\n'))
vim.bo[buf].filetype = 'lua'
vim.api.nvim_set_current_buf(buf)
elseif cmd.subcommand == 'clear' then
cache.load()
if cmd.platform then
if vim.tbl_contains(platforms, cmd.platform) then

View file

@ -44,11 +44,11 @@ local function parse_command(args)
if not subcommand then
return { type = 'error', message = 'cache command requires subcommand: clear' }
end
if subcommand == 'clear' then
if vim.tbl_contains({ 'clear', 'read' }, subcommand) then
local platform = filtered_args[3]
return {
type = 'cache',
subcommand = 'clear',
subcommand = subcommand,
platform = platform,
}
else