Adds `.gitlab.nvim` configuration file option.
This commit is contained in:
Harrison (Harry) Cramer
2023-04-22 14:19:12 -04:00
committed by GitHub
parent 899e04082e
commit 08463c0b84
3 changed files with 39 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ M.setup = function(args, build_only)
state.BIN_PATH = parent_dir
state.BIN = parent_dir .. "/bin"
if args == nil then args = {} end
if args.dev == true then
M.build(args)
end
@@ -62,7 +63,15 @@ M.setup = function(args, build_only)
if build_only then return end
-- Override project_id in setup call if configuration file is present
local config_file_path = vim.fn.getcwd() .. "/.gitlab.nvim"
local config_file_content = read_file(config_file_path)
if config_file_content ~= nil then
args.project_id = config_file_content
end
if args.project_id == nil then
args.project_id = u.read_file(state.BIN_PATH .. "/.gitlab/project_id")
error("No project ID provided!")
end