mirror of
https://github.com/taigrr/glaze.nvim.git
synced 2026-04-02 03:09:10 -07:00
feat: add auto_update config, clarify auto_install vs auto_update vs auto_check
- auto_install (default: true) — install missing binaries on register - auto_check (default: true) — check for available updates periodically - auto_update (default: false) — auto-update when newer versions found - Disabling auto_check also disables auto_update - Updated README and help docs
This commit is contained in:
@@ -133,9 +133,12 @@ require("glaze").setup({
|
|||||||
silent = false, -- Suppress install notifications
|
silent = false, -- Suppress install notifications
|
||||||
},
|
},
|
||||||
auto_check = {
|
auto_check = {
|
||||||
enabled = true, -- Auto-check for updates
|
enabled = true, -- Auto-check for updates (disabling also disables auto_update)
|
||||||
frequency = "daily", -- "daily", "weekly", or hours as number
|
frequency = "daily", -- "daily", "weekly", or hours as number
|
||||||
},
|
},
|
||||||
|
auto_update = {
|
||||||
|
enabled = false, -- Auto-update binaries when newer versions are found (requires auto_check)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -156,9 +156,12 @@ Default configuration:
|
|||||||
silent = false, -- Suppress install notifications
|
silent = false, -- Suppress install notifications
|
||||||
},
|
},
|
||||||
auto_check = {
|
auto_check = {
|
||||||
enabled = true, -- Auto-check for updates on setup
|
enabled = true, -- Auto-check for updates (disabling also disables auto_update)
|
||||||
frequency = "daily", -- "daily", "weekly", or hours (number)
|
frequency = "daily", -- "daily", "weekly", or hours (number)
|
||||||
},
|
},
|
||||||
|
auto_update = {
|
||||||
|
enabled = false, -- Auto-update when newer versions found (requires auto_check)
|
||||||
|
},
|
||||||
})
|
})
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|||||||
@@ -201,10 +201,22 @@ function M.check(opts)
|
|||||||
end
|
end
|
||||||
write_state(state)
|
write_state(state)
|
||||||
|
|
||||||
if not opts.silent then
|
-- Auto-update if enabled (requires auto_check to be enabled)
|
||||||
|
if updates_found > 0 and glaze.config.auto_update.enabled and glaze.config.auto_check.enabled then
|
||||||
|
vim.schedule(function()
|
||||||
|
local to_update = {}
|
||||||
|
for n, i in pairs(M._update_info) do
|
||||||
|
if i.has_update then
|
||||||
|
table.insert(to_update, n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.notify("Glaze: auto-updating " .. #to_update .. " binary(ies)…", vim.log.levels.INFO)
|
||||||
|
require("glaze.runner").update(to_update)
|
||||||
|
end)
|
||||||
|
elseif not opts.silent then
|
||||||
if updates_found > 0 then
|
if updates_found > 0 then
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.notify("Glaze: " .. updates_found .. " update(s) available", vim.log.levels.INFO)
|
vim.notify("Glaze: " .. updates_found .. " update(s) available — run :GlazeUpdate", vim.log.levels.INFO)
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
@@ -213,7 +225,7 @@ function M.check(opts)
|
|||||||
end
|
end
|
||||||
elseif updates_found > 0 then
|
elseif updates_found > 0 then
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.notify("Glaze: " .. updates_found .. " update(s) available", vim.log.levels.INFO)
|
vim.notify("Glaze: " .. updates_found .. " update(s) available — run :GlazeUpdate", vim.log.levels.INFO)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,16 @@ local M = {}
|
|||||||
---@field enabled boolean Whether to auto-install missing binaries on register
|
---@field enabled boolean Whether to auto-install missing binaries on register
|
||||||
---@field silent boolean Suppress notifications during auto-install
|
---@field silent boolean Suppress notifications during auto-install
|
||||||
|
|
||||||
|
---@class GlazeAutoUpdateConfig
|
||||||
|
---@field enabled boolean Whether to auto-update binaries when newer versions are found (requires auto_check)
|
||||||
|
|
||||||
---@class GlazeConfig
|
---@class GlazeConfig
|
||||||
---@field ui GlazeUIConfig
|
---@field ui GlazeUIConfig
|
||||||
---@field concurrency number Max parallel installations
|
---@field concurrency number Max parallel installations
|
||||||
---@field go_cmd string[] Go command (supports goenv)
|
---@field go_cmd string[] Go command (supports goenv)
|
||||||
---@field auto_check GlazeAutoCheckConfig
|
|
||||||
---@field auto_install GlazeAutoInstallConfig
|
---@field auto_install GlazeAutoInstallConfig
|
||||||
|
---@field auto_check GlazeAutoCheckConfig
|
||||||
|
---@field auto_update GlazeAutoUpdateConfig
|
||||||
|
|
||||||
---@class GlazeUIConfig
|
---@class GlazeUIConfig
|
||||||
---@field border string Border style
|
---@field border string Border style
|
||||||
@@ -60,13 +64,16 @@ M.config = {
|
|||||||
},
|
},
|
||||||
concurrency = 4,
|
concurrency = 4,
|
||||||
go_cmd = { "go" },
|
go_cmd = { "go" },
|
||||||
|
auto_install = {
|
||||||
|
enabled = true,
|
||||||
|
silent = false,
|
||||||
|
},
|
||||||
auto_check = {
|
auto_check = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
frequency = "daily",
|
frequency = "daily",
|
||||||
},
|
},
|
||||||
auto_install = {
|
auto_update = {
|
||||||
enabled = true,
|
enabled = false,
|
||||||
silent = false,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user