From 648437aafae63eda06097113c836a8d9ad6f23c1 Mon Sep 17 00:00:00 2001 From: William Boman Date: Fri, 7 Jan 2022 12:18:47 +0100 Subject: feat: integrate gh-cli for GitHub API calls (#403) Closes #248. --- lua/nvim-lsp-installer/core/clients/github.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lua/nvim-lsp-installer/core/clients/github.lua') 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"). -- cgit v1.2.3-70-g09d2