mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
fix(dashboard): hash dashboard terminal section caching key to support long commands (#381)
## Description This change hashes the caching key for snacks dashboards terminal sections instead of building the key from the command itself. This allows for arbitrary length scripts to be given as a terminal section command instead of relying on existing commands in PATH. ## Related Issue(s) #379 ## Screenshots <img width="1176" alt="image" src="https://github.com/user-attachments/assets/77a376c1-75b6-4023-8984-efd590f66a68" />
This commit is contained in:
parent
ec346843e0
commit
d312053f78
1 changed files with 3 additions and 2 deletions
|
@ -943,10 +943,11 @@ function M.sections.terminal(opts)
|
|||
table.concat(type(cmd) == "table" and cmd or { cmd }, " "),
|
||||
uv.cwd(),
|
||||
opts.random and math.random(1, opts.random) or "",
|
||||
"txt",
|
||||
}
|
||||
local hashed_cache_key = vim.fn.sha256(table.concat(cache_parts, "."))
|
||||
|
||||
local cache_dir = vim.fn.stdpath("cache") .. "/snacks"
|
||||
local cache_file = cache_dir .. "/" .. table.concat(cache_parts, "."):gsub("[^%w%-_%.]", "_")
|
||||
local cache_file = cache_dir .. "/" .. hashed_cache_key .. ".txt"
|
||||
local stat = uv.fs_stat(cache_file)
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
local chan = vim.api.nvim_open_term(buf, {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue