diff --git a/README.md b/README.md index e5234f8..f1449d1 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ return { "stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers. enabled = true, }, - build = function () require("gitlab.server").build() end, -- Builds the Go binary + build = function () require("gitlab.server").build(true) end, -- Builds the Go binary config = function() require("gitlab").setup() end, @@ -56,7 +56,7 @@ use { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, - run = function() require("gitlab.server").build() end, + run = function() require("gitlab.server").build(true) end, config = function() require("gitlab").setup() end, @@ -244,7 +244,7 @@ vim.keymap.set("n", "glp", gitlab.pipeline) This plugin uses a Golang server to reach out to Gitlab. It's possible that something is going wrong when starting that server or connecting with Gitlab. The Golang server runs outside of Neovim, and can be interacted with directly in order to troubleshoot. To start the server, check out your feature branch and run these commands: ``` -:lua require("gitlab.server").build() +:lua require("gitlab.server").build(true) :lua require("gitlab.server").start(function() print("Server started") end) ``` diff --git a/lua/gitlab/server.lua b/lua/gitlab/server.lua index be073ba..cc255c3 100644 --- a/lua/gitlab/server.lua +++ b/lua/gitlab/server.lua @@ -1,7 +1,6 @@ -- This module contains the logic responsible for building and starting -- the Golang server. The Go server is responsible for making API calls -- to Gitlab and returning the data -local job = require("gitlab.job") local state = require("gitlab.state") local u = require("gitlab.utils") local M = {} @@ -43,7 +42,7 @@ end -- Builds the Go binary -M.build = function() +M.build = function(override) if not u.has_delta() then vim.notify("Please install delta to use gitlab.nvim!", vim.log.levels.ERROR) return @@ -54,8 +53,10 @@ M.build = function() state.settings.bin_path = parent_dir state.settings.bin = parent_dir .. "/bin" - local binary_exists = vim.loop.fs_stat(state.settings.bin) - if binary_exists ~= nil then return end + if not override then + local binary_exists = vim.loop.fs_stat(state.settings.bin) + if binary_exists ~= nil then return end + end local command = string.format("cd %s && make", state.settings.bin_path) local installCode = os.execute(command .. "> /dev/null")