Merge remote-tracking branch 'origin/main' into docs/sync-s3-auto-auth
# Conflicts: # doc/pending.txt # lua/pending/config.lua # lua/pending/forge.lua # spec/forge_spec.lua
This commit is contained in:
commit
d043c6aaee
5 changed files with 113 additions and 15 deletions
|
|
@ -63,6 +63,14 @@ function M.backends()
|
|||
return _backends
|
||||
end
|
||||
|
||||
function M._reset_instances()
|
||||
_instances_resolved = false
|
||||
_by_shorthand = {}
|
||||
for _, b in ipairs(_backends) do
|
||||
_by_shorthand[b.shorthand] = b
|
||||
end
|
||||
end
|
||||
|
||||
local function _ensure_instances()
|
||||
if _instances_resolved then
|
||||
return
|
||||
|
|
@ -74,17 +82,27 @@ local function _ensure_instances()
|
|||
for _, inst in ipairs(forge_cfg.instances or {}) do
|
||||
_by_host[inst] = backend
|
||||
end
|
||||
if forge_cfg.shorthand and forge_cfg.shorthand ~= backend.shorthand then
|
||||
_by_shorthand[backend.shorthand] = nil
|
||||
backend.shorthand = forge_cfg.shorthand
|
||||
_by_shorthand[backend.shorthand] = backend
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@param token string
|
||||
---@return pending.ForgeRef?
|
||||
function M._parse_shorthand(token)
|
||||
local prefix, rest = token:match('^(%l%l):(.+)$')
|
||||
if not prefix then
|
||||
return nil
|
||||
_ensure_instances()
|
||||
local backend, rest
|
||||
for prefix, b in pairs(_by_shorthand) do
|
||||
local candidate = token:match('^' .. vim.pesc(prefix) .. ':(.+)$')
|
||||
if candidate then
|
||||
backend = b
|
||||
rest = candidate
|
||||
break
|
||||
end
|
||||
end
|
||||
local backend = _by_shorthand[prefix]
|
||||
if not backend then
|
||||
return nil
|
||||
end
|
||||
|
|
@ -291,7 +309,7 @@ end
|
|||
---@param s pending.Store
|
||||
function M.refresh(s)
|
||||
local forge_cfg = config.get().forge or {}
|
||||
if not forge_cfg.auto_close then
|
||||
if not forge_cfg.close then
|
||||
return
|
||||
end
|
||||
local tasks = s:tasks()
|
||||
|
|
@ -309,7 +327,7 @@ function M.refresh(s)
|
|||
any_fetched = true
|
||||
local forge_cfg = config.get().forge or {}
|
||||
if
|
||||
forge_cfg.auto_close
|
||||
forge_cfg.close
|
||||
and (cache.state == 'closed' or cache.state == 'merged')
|
||||
and (task.status == 'pending' or task.status == 'wip' or task.status == 'blocked')
|
||||
then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue