Add netrc support

This commit is contained in:
Tim Pope
2012-10-18 13:33:08 -04:00
parent a17d35dfae
commit 280a7b12df
2 changed files with 8 additions and 2 deletions

View File

@@ -87,7 +87,7 @@ endfunction
function! s:curl_arguments(path, ...) abort
let options = a:0 ? a:1 : {}
let args = ['--silent']
let args = ['-q', '--silent']
call extend(args, ['-H', 'Accept: application/json'])
call extend(args, ['-H', 'Content-Type: application/json'])
if get(options, 'auth', '') =~# ':'
@@ -96,8 +96,10 @@ function! s:curl_arguments(path, ...) abort
call extend(args, ['-H', 'Authorization: bearer ' . options.auth])
elseif exists('g:RHUBARB_TOKEN')
call extend(args, ['-H', 'Authorization: bearer ' . g:RHUBARB_TOKEN])
else
elseif s:credentials() !~# '^[^:]*:$'
call extend(args, ['-u', s:credentials()])
else
call extend(args, ['--netrc'])
endif
if has_key(options, 'method')
call extend(args, ['-X', toupper(options.method)])