1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 06:50:04 +08:00

fix(github.vim): handle curl command error

This commit is contained in:
wsdjeg 2022-05-29 21:06:44 +08:00
parent d45150caba
commit 5ac713041d

View File

@ -8,9 +8,14 @@ function! github#api#users#GetAllUsers() abort
endfunction
function! github#api#users#starred(user,page) abort
return json_decode(join(systemlist('curl -s https://api.github.com/users/' .
\a:user . '/starred' . '?page=' . a:page ),"\n"))
function! github#api#users#starred(user, page) abort
let result = system('curl -s https://api.github.com/users/' .
\ a:user . '/starred' . '?page=' . a:page)
if !v:shell_error
return json_decode(result)
endif
" if the command run failed, return empty list
return []
endfunction
function! github#api#users#starred_pages(user) abort