aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/core/clients/github.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-01-07 12:18:47 +0100
committerGitHub <noreply@github.com>2022-01-07 12:18:47 +0100
commit648437aafae63eda06097113c836a8d9ad6f23c1 (patch)
tree52d1ff402bf62dcd3616b795cde3ba7c4c1c0f35 /lua/nvim-lsp-installer/core/clients/github.lua
parentfix(ui): less intrusive version check UI (#402) (diff)
downloadmason-648437aafae63eda06097113c836a8d9ad6f23c1.tar
mason-648437aafae63eda06097113c836a8d9ad6f23c1.tar.gz
mason-648437aafae63eda06097113c836a8d9ad6f23c1.tar.bz2
mason-648437aafae63eda06097113c836a8d9ad6f23c1.tar.lz
mason-648437aafae63eda06097113c836a8d9ad6f23c1.tar.xz
mason-648437aafae63eda06097113c836a8d9ad6f23c1.tar.zst
mason-648437aafae63eda06097113c836a8d9ad6f23c1.zip
feat: integrate gh-cli for GitHub API calls (#403)
Closes #248.
Diffstat (limited to 'lua/nvim-lsp-installer/core/clients/github.lua')
-rw-r--r--lua/nvim-lsp-installer/core/clients/github.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/lua/nvim-lsp-installer/core/clients/github.lua b/lua/nvim-lsp-installer/core/clients/github.lua
index 080edbb0..27352e8d 100644
--- a/lua/nvim-lsp-installer/core/clients/github.lua
+++ b/lua/nvim-lsp-installer/core/clients/github.lua
@@ -19,7 +19,12 @@ function M.fetch_releases(repo, callback)
return callback("Failed to fetch GitHub releases.", nil)
end
callback(nil, vim.json.decode(response))
- end)
+ end, {
+ custom_fetcher = {
+ cmd = "gh",
+ args = { "api", ("repos/%s/releases"):format(repo) },
+ },
+ })
end
---@alias FetchLatestGithubReleaseOpts {tag_name_pattern:string}
@@ -62,7 +67,12 @@ function M.fetch_tags(repo, callback)
return callback("Failed to fetch tags.", nil)
end
callback(nil, vim.json.decode(response))
- end)
+ end, {
+ custom_fetcher = {
+ cmd = "gh",
+ args = { "api", ("repos/%s/tags"):format(repo) },
+ },
+ })
end
---@param repo string The GitHub repo ("username/repo").