Bang refactoring

- pass booleans instead '!'
This commit is contained in:
gmarik 2011-03-04 15:52:08 -06:00
parent 39eaa069ec
commit 2df30b4c4f
2 changed files with 5 additions and 5 deletions

View File

@ -5,11 +5,11 @@
" Version: 0.5 " Version: 0.5
com! -nargs=+ Bundle call vundle#config#bundle(<args>) com! -nargs=+ Bundle call vundle#config#bundle(<args>)
com! -nargs=? -bang BundleInstall call vundle#installer#install('<bang>') com! -nargs=? -bang BundleInstall call vundle#installer#install('!' == '<bang>')
com! -nargs=? -bang BundleClean call vundle#installer#clean('<bang>') com! -nargs=? -bang BundleClean call vundle#installer#clean('!' == '<bang>')
com! -nargs=0 BundleDocs call vundle#installer#helptags() com! -nargs=0 BundleDocs call vundle#installer#helptags()
com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search('<bang>', <q-args>) com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search('!' == '<bang>', <q-args>)
com! -nargs=0 VundleLog silent pedit `=g:vundle_log` com! -nargs=0 VundleLog silent pedit `=g:vundle_log`

View File

@ -1,7 +1,7 @@
func! vundle#installer#install(bang) func! vundle#installer#install(bang)
call s:reload_bundles() call s:reload_bundles()
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif
for bundle in g:bundles | call s:install('!' == a:bang, bundle) | endfor for bundle in g:bundles | call s:install(a:bang, bundle) | endfor
call vundle#installer#helptags() call vundle#installer#helptags()
endf endf
@ -18,7 +18,7 @@ func! vundle#installer#clean(bang)
let all_dirs = split(globpath(g:bundle_dir, '*'), "\n") let all_dirs = split(globpath(g:bundle_dir, '*'), "\n")
let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)')
if (!empty(x_dirs)) if (!empty(x_dirs))
if ('!' == a:bang || input('Are you sure you want to remove '.len(x_dirs).' bundles?') =~? 'y') if (a:bang || input('Are you sure you want to remove '.len(x_dirs).' bundles?') =~? 'y')
exec '!rm -rf '.join(map(x_dirs, 'shellescape(v:val)'), ' ') exec '!rm -rf '.join(map(x_dirs, 'shellescape(v:val)'), ' ')
endif endif
end end