Skip to content

Commit

Permalink
Display message only once after all jobs are finished. Fix #13
Browse files Browse the repository at this point in the history
  • Loading branch information
semanser committed Dec 2, 2018
1 parent 0c79e8e commit 541dc0a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions plugin/vim-outdated-plugins.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ function! s:JobHandler(job_id, data, event) dict
endfunction

function! s:CalculateUpdates(job_id, data, event) dict
if g:pluginsToUpdate > 0
echom 'Plugins to update: ' . g:pluginsToUpdate
else
echom 'All plugins up-to-date'
call remove(g:check_for_updates_jobids, a:job_id)

if len(g:check_for_updates_jobids) == 0
if g:pluginsToUpdate > 0
echom 'Plugins to update: ' . g:pluginsToUpdate
else
echom 'All plugins up-to-date'
endif
endif
endfunction

Expand All @@ -19,10 +23,11 @@ let s:callbacks = {

function! CheckForUpdates()
let g:pluginsToUpdate = 0
let g:check_for_updates_jobids = {}

" TODO check only activated plugins and not all downloaded
for key in keys(g:plugs)
let job = async#job#start([ 'bash', '-c', "cd " . g:plugs[key].dir ." && git remote update > /dev/null && git rev-list HEAD..origin --count"], s:callbacks)
let g:check_for_updates_jobids[async#job#start([ 'bash', '-c', "cd " . g:plugs[key].dir ." && git remote update > /dev/null && git rev-list HEAD..origin --count"], s:callbacks)] = key
endfor
endfunction

Expand Down

0 comments on commit 541dc0a

Please sign in to comment.