Skip to content

Commit

Permalink
fix: don't show "Updated rock" notification on failed update
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jan 24, 2024
1 parent 91901b5 commit ee640cd
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lua/rocks/operations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -485,25 +485,26 @@ operations.update = function()
local success, ret = pcall(future.wait)
ct = ct + 1
nio.scheduler()
if not success then
report_error(("Failed to update %s."):format(rock.name))
if success then
---@type rock_name
local rock_name = ret.name
local user_rock = user_rocks.plugins[rock_name]
if user_rock and user_rock.version then
-- Rock is configured as a table -> Update version.
user_rocks.plugins[rock_name].version = ret.version
else
user_rocks.plugins[rock_name] = ret.version
end
progress_handle:report({
message = ("Updated %s: %s -> %s"):format(rock.name, rock.version, rock.target_version),
percentage = get_percentage(ct, #outdated_rocks),
})
end
---@type rock_name
local rock_name = ret.name
local user_rock = user_rocks.plugins[rock_name]
if user_rock and user_rock.version then
-- Rock is configured as a table -> Update version.
user_rocks.plugins[rock_name].version = ret.version
else
user_rocks.plugins[rock_name] = ret.version
report_error(("Failed to update %s."):format(rock.name))
progress_handle:report({
percentage = get_percentage(ct, #outdated_rocks),
})
end
progress_handle:report({
message = ("Updated %s: %s -> %s"):format(rock.name, rock.version, rock.target_version),
percentage = get_percentage(ct, #outdated_rocks),
})
end

if vim.tbl_isempty(outdated_rocks) then
Expand Down

0 comments on commit ee640cd

Please sign in to comment.