Skip to content

Commit

Permalink
feat(unfinished): check archived plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
aceforeverd committed May 21, 2023
1 parent ac1c195 commit 4db8d89
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/aceforeverd/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ function M.setup()

require('aceforeverd.plugins').setup()

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

-- keep vim default maps
-- set_map('x', ']"', '"', { noremap = true, silent = true })
end
Expand Down
26 changes: 26 additions & 0 deletions lua/aceforeverd/plugins/util.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local base = 'https://api.github.com/repo/'

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

function GetOldPlugins()
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, {value, 'archived'})
end
end

vim.api.nvim_notify(vim.inspect(out), vim.log.levels.INFO, {})
end

return {
GetOldPlugins = GetOldPlugins
}

0 comments on commit 4db8d89

Please sign in to comment.