Closed bpb closed 5 months ago
Updating the regex for project extraction fixed the issue for me ([^@/:]+)[:/]([^/]+/[^/]+)$
Also seeing as how you are already leaning on gh cli slightly for token auth I suggest allowing the option for gh api
command to make api calls to github.
The reason being some organizations may restrict http based authorization tokens and may require client based OAuth.
It appears that this can be easily done by replacing the fetch function like so if gh is present or selected.
---@param server string
---@param path string
---@param opts? table
function M.fetch(server, path, opts)
opts = opts or {}
opts.callback = opts.callback and vim.schedule_wrap(opts.callback)
local command = string.format("gh api %s", path)
if opts.method then
command = command .. " -X " .. opts.method:upper()
end
if opts.body then
command = command .. " -f '" .. vim.json.encode(opts.body) .. "'"
end
local res = vim.fn.system(command)
if opts.callback then
opts.callback({ body = res })
end
return res
end
I updated the regex to your provided solution.
Happy to accept a PR which updates/changes the fetch method too. I personally do run the the plugin on some machines without the github cli and a manual token though, and would need backwards compatibility on that one.
Not sure why plenary is fudging up the curl url? Is it expecting http github access?