committed by
GitHub
parent
899e04082e
commit
08463c0b84
@@ -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
|
||||
|
||||
|
||||
@@ -204,7 +204,16 @@ M.merge_tables = function(defaults, overrides)
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
function read_file(file_path)
|
||||
local file = io.open(file_path, "r")
|
||||
if file == nil then
|
||||
return nil
|
||||
end
|
||||
local file_contents = file:read("*all")
|
||||
file:close()
|
||||
file_contents = string.gsub(file_contents, "\n", "")
|
||||
return file_contents
|
||||
end
|
||||
|
||||
M.get_relative_file_path = get_relative_file_path
|
||||
M.get_current_line_number = get_current_line_number
|
||||
|
||||
Reference in New Issue
Block a user