mirror of
https://github.com/tpope/vim-rhubarb.git
synced 2025-12-06 20:24:29 +08:00
Add netrc support
This commit is contained in:
@@ -38,6 +38,10 @@ rhubarb.vim your GitHub credentials:
|
|||||||
let g:github_user = '<user>'
|
let g:github_user = '<user>'
|
||||||
let g:github_password = '<password>'
|
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
|
If you don't have a preferred installation method, I recommend
|
||||||
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
||||||
then simply copy and paste:
|
then simply copy and paste:
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:curl_arguments(path, ...) abort
|
function! s:curl_arguments(path, ...) abort
|
||||||
let options = a:0 ? a:1 : {}
|
let options = a:0 ? a:1 : {}
|
||||||
let args = ['--silent']
|
let args = ['-q', '--silent']
|
||||||
call extend(args, ['-H', 'Accept: application/json'])
|
call extend(args, ['-H', 'Accept: application/json'])
|
||||||
call extend(args, ['-H', 'Content-Type: application/json'])
|
call extend(args, ['-H', 'Content-Type: application/json'])
|
||||||
if get(options, 'auth', '') =~# ':'
|
if get(options, 'auth', '') =~# ':'
|
||||||
@@ -96,8 +96,10 @@ function! s:curl_arguments(path, ...) abort
|
|||||||
call extend(args, ['-H', 'Authorization: bearer ' . options.auth])
|
call extend(args, ['-H', 'Authorization: bearer ' . options.auth])
|
||||||
elseif exists('g:RHUBARB_TOKEN')
|
elseif exists('g:RHUBARB_TOKEN')
|
||||||
call extend(args, ['-H', 'Authorization: bearer ' . g:RHUBARB_TOKEN])
|
call extend(args, ['-H', 'Authorization: bearer ' . g:RHUBARB_TOKEN])
|
||||||
else
|
elseif s:credentials() !~# '^[^:]*:$'
|
||||||
call extend(args, ['-u', s:credentials()])
|
call extend(args, ['-u', s:credentials()])
|
||||||
|
else
|
||||||
|
call extend(args, ['--netrc'])
|
||||||
endif
|
endif
|
||||||
if has_key(options, 'method')
|
if has_key(options, 'method')
|
||||||
call extend(args, ['-X', toupper(options.method)])
|
call extend(args, ['-X', toupper(options.method)])
|
||||||
|
|||||||
Reference in New Issue
Block a user