Permalink
Browse files

Add netrc support

  • Loading branch information...
1 parent a17d35d commit 280a7b12dfe2ee776db6c22ee2ed312959284a31 @tpope committed Oct 18, 2012
Showing with 8 additions and 2 deletions.
  1. +4 −0 README.markdown
  2. +4 −2 plugin/rhubarb.vim
View
@@ -38,6 +38,10 @@ rhubarb.vim your GitHub credentials:
let g:github_user = '<user>'
let g:github_password = '<password>'
+4. In a netrc:
+
+ echo 'machine api.github.com login <user> password <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:
View
@@ -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)])

0 comments on commit 280a7b1

Please sign in to comment.