Imroved logging

This commit is contained in:
gmarik 2010-12-08 22:10:26 -06:00
parent 7183003b26
commit f324315826

View File

@ -34,7 +34,7 @@ endf
func! vundle#helptags() func! vundle#helptags()
let c = 0 let c = 0
for bundle in g:bundles | let c += s:helptags(bundle.rtpath()) | endfor for bundle in g:bundles | let c += s:helptags(bundle.rtpath()) | endfor
echo 'Done. '.c.' bundles processed' call s:log('Done. '.c.' bundles processed')
endf endf
func! s:parse_options(opts) func! s:parse_options(opts)
@ -79,17 +79,17 @@ func! s:sync(bang, bundle)
let git_dir = a:bundle.path().'/.git' let git_dir = a:bundle.path().'/.git'
if isdirectory(git_dir) if isdirectory(git_dir)
if !(a:bang) | return 0 | endif if !(a:bang) | return 0 | endif
silent exec '!cd '.a:bundle.path().'; git pull' silent exec '!cd '.a:bundle.path().'; git pull >/dev/null 2>&1'
else else
silent exec '!git clone '.a:bundle.uri.' '.a:bundle.path() silent exec '!git clone '.a:bundle.uri.' '.a:bundle.path().' >/dev/null 2>&1'
endif endif
return 1 return 1
endf endf
func! s:install(bang, bundle) func! s:install(bang, bundle)
let synced = s:sync(a:bang, a:bundle) let synced = s:sync(a:bang, a:bundle)
echo a:bundle.name.' '.(synced ? ' ': ' already').' installed'
call s:helptags(a:bundle.rtpath()) call s:helptags(a:bundle.rtpath())
call s:log(a:bundle.name.' '.(synced ? ' ': ' already').' installed')
endf endf
func! s:rtp_rm(dir) func! s:rtp_rm(dir)
@ -102,6 +102,16 @@ func! s:rtp_add(dir)
exec 'set rtp+='.expand(a:dir.'/after') exec 'set rtp+='.expand(a:dir.'/after')
endf endf
func! s:log(msg)
if has('gui_running')
echo a:msg
else
" console vim requires to hit ENTER after each !cmd with stdout output
" workaround
silent exec '! echo '.a:msg.' >&2| cat >/dev/null'
endif
endf
let s:bundle = {} let s:bundle = {}
func! s:bundle.path() func! s:bundle.path()
@ -111,3 +121,4 @@ endf
func! s:bundle.rtpath() func! s:bundle.rtpath()
return has_key(self, 'rtp') ? join([self.path(), self.rtp], '/') : self.path() return has_key(self, 'rtp') ? join([self.path(), self.rtp], '/') : self.path()
endf endf