summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-05-23 14:39:20 -0400
committerSquibid <me@zacharyscheiman.com>2023-05-23 14:39:20 -0400
commit7cf8bc3a4c22fe4c8b14cd5ffcefee1cbced9f22 (patch)
treef1b533f5cc6958c3d7b4ce2f3c32964a4ec24401
parent834f7ffaac7b4370ee32911ebb2105b63f0fbf68 (diff)
downloadnvim-7cf8bc3a4c22fe4c8b14cd5ffcefee1cbced9f22.tar.gz
nvim-7cf8bc3a4c22fe4c8b14cd5ffcefee1cbced9f22.tar.bz2
nvim-7cf8bc3a4c22fe4c8b14cd5ffcefee1cbced9f22.zip
check if we are up to date with remote repo
-rw-r--r--lua/mngr/menu.lua3
-rw-r--r--lua/mngr/updates.lua14
2 files changed, 17 insertions, 0 deletions
diff --git a/lua/mngr/menu.lua b/lua/mngr/menu.lua
index 958c466..9300de2 100644
--- a/lua/mngr/menu.lua
+++ b/lua/mngr/menu.lua
@@ -35,6 +35,9 @@ local function configmenu()
if package.loaded['mason'] then
require('mason.api.command').MasonUpdate()
end
+ if choice == 'update config' then
+ require('mngr.updates')
+ end
if choice == 'show keybinds' then
require('telescope.builtin').keymaps()
end
diff --git a/lua/mngr/updates.lua b/lua/mngr/updates.lua
index e69de29..653af67 100644
--- a/lua/mngr/updates.lua
+++ b/lua/mngr/updates.lua
@@ -0,0 +1,14 @@
+-- janky popen madness to use curl without luarocks
+local remoteCommit = io.popen([[curl -s https://git.squi.bid/nvim/commit/ | grep -o "<a href='/nvim/commit/?id=.*>" | cut -d "'" -f 2 | cut -d "=" -f 2 | head -1]])
+local remoteResult = remoteCommit:read("*a")
+remoteCommit:close()
+
+local localCommit = io.popen([[cd $XDG_CONFIG_HOME/nvim; git log | head -1 | cut -d " " -f 2]])
+local localResult = localCommit:read("*a")
+localCommit:close()
+
+if remoteResult ~= localResult then
+ vim.notify("Out of date with remote repo :(", vim.log.levels.WARN, {title = "Nvim Config"})
+else
+ vim.notify("Up to date with remote repo :)", vim.log.levels.INFO, {title = "Nvim Config"})
+end