From 280a7b12dfe2ee776db6c22ee2ed312959284a31 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 18 Oct 2012 13:33:08 -0400 Subject: [PATCH] Add netrc support --- README.markdown | 4 ++++ plugin/rhubarb.vim | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index e2eb818..4e0b637 100644 --- a/README.markdown +++ b/README.markdown @@ -38,6 +38,10 @@ rhubarb.vim your GitHub credentials: let g:github_user = '' let g:github_password = '' +4. In a netrc: + + echo 'machine api.github.com login password '>>~/.netrc + If you don't have a preferred installation method, I recommend installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and then simply copy and paste: diff --git a/plugin/rhubarb.vim b/plugin/rhubarb.vim index a605a38..09422d6 100644 --- a/plugin/rhubarb.vim +++ b/plugin/rhubarb.vim @@ -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)])