Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check archived plugins #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lua/aceforeverd/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ function M.setup()
-- keymap guideline
-- <space>xxx -> view-only operators
-- <leader>xxx -> possibly write operators

vim.api.nvim_create_user_command('PackCheckHealth', [[lua require('aceforeverd.plugins.util').GetOldPlugins()]], {})
end

return M
41 changes: 41 additions & 0 deletions lua/aceforeverd/plugins/util.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
local base = 'https://api.github.com/repo/'

function GetRepo(repo)
local curl = require('plenary.curl')
return curl.get(base .. repo)
end

function GetOldPlugins()
-- minpac plugins
local plugins = vim.fn['minpac#getpluglist']()
local out = {}
for _, value in pairs(plugins) do
local url = value['url']
local repo = vim.fn.substitute(url, [[^https://github.com/]], '', '')
local stats = GetRepo(repo)

if stats ~= nil and stats.archived == true then
table.insert(out, repo)
else
vim.notify('ok: ' .. repo, vim.log.levels.INFO, {})
end
end

-- lazy plugins
local lua_plugins = require('aceforeverd.plugins').plugin_list
for _, value in pairs(lua_plugins) do
local stats = GetRepo(value[0])

if stats ~= nil and stats.archived == true then
table.insert(out, value[0])
else
vim.notify('ok: ' .. value[0], vim.log.levels.INFO, {})
end
end

vim.notify('archived: ' .. vim.inspect(out), vim.log.levels.INFO, {})
end

return {
GetOldPlugins = GetOldPlugins
}