From 6b9b12386f5fc336bce6394d7fe2ca10e07794ce Mon Sep 17 00:00:00 2001 From: aceforeverd Date: Sat, 5 Aug 2023 22:48:32 +0800 Subject: [PATCH 1/2] feat(unfinished): check archived plugins --- lua/aceforeverd/init.lua | 2 ++ lua/aceforeverd/plugins/util.lua | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 lua/aceforeverd/plugins/util.lua diff --git a/lua/aceforeverd/init.lua b/lua/aceforeverd/init.lua index 16c4d59..24c6c21 100644 --- a/lua/aceforeverd/init.lua +++ b/lua/aceforeverd/init.lua @@ -46,6 +46,8 @@ function M.setup() -- keymap guideline -- xxx -> view-only operators -- xxx -> possibly write operators + + vim.api.nvim_create_user_command('GetOldPlugins', [[lua require('aceforeverd.plugins.util').GetOldPlugins()]], {}) end return M diff --git a/lua/aceforeverd/plugins/util.lua b/lua/aceforeverd/plugins/util.lua new file mode 100644 index 0000000..280a250 --- /dev/null +++ b/lua/aceforeverd/plugins/util.lua @@ -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 +} From 59677e3346d270ab58243d8a9eaadc6bb19f3375 Mon Sep 17 00:00:00 2001 From: aceforeverd Date: Sun, 6 Aug 2023 12:04:58 +0800 Subject: [PATCH 2/2] save changes --- lua/aceforeverd/init.lua | 2 +- lua/aceforeverd/plugins/util.lua | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lua/aceforeverd/init.lua b/lua/aceforeverd/init.lua index 24c6c21..67df4ab 100644 --- a/lua/aceforeverd/init.lua +++ b/lua/aceforeverd/init.lua @@ -47,7 +47,7 @@ function M.setup() -- xxx -> view-only operators -- xxx -> possibly write operators - vim.api.nvim_create_user_command('GetOldPlugins', [[lua require('aceforeverd.plugins.util').GetOldPlugins()]], {}) + vim.api.nvim_create_user_command('PackCheckHealth', [[lua require('aceforeverd.plugins.util').GetOldPlugins()]], {}) end return M diff --git a/lua/aceforeverd/plugins/util.lua b/lua/aceforeverd/plugins/util.lua index 280a250..5cf42f0 100644 --- a/lua/aceforeverd/plugins/util.lua +++ b/lua/aceforeverd/plugins/util.lua @@ -6,6 +6,7 @@ function GetRepo(repo) end function GetOldPlugins() + -- minpac plugins local plugins = vim.fn['minpac#getpluglist']() local out = {} for _, value in pairs(plugins) do @@ -14,11 +15,25 @@ function GetOldPlugins() local stats = GetRepo(repo) if stats ~= nil and stats.archived == true then - table.insert(out, {value, 'archived'}) + table.insert(out, repo) + else + vim.notify('ok: ' .. repo, vim.log.levels.INFO, {}) end end - vim.api.nvim_notify(vim.inspect(out), vim.log.levels.INFO, {}) + -- 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 {