1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 00:10:07 +08:00

Add achievements func

This commit is contained in:
wsdjeg 2017-06-27 23:08:00 +08:00
parent b34e3bec94
commit 9e69df0c85
2 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,37 @@
function! s:generate_content() abort
let content = []
let content += s:issues_ac()
return content
endfunction
function! s:find_position() abort
let start = search('<!-- SpaceVim Achievements start -->','bwnc')
let end = search('<!-- SpaceVim Achievements end -->','bnwc')
return [start, end]
endfunction
function! s:issues_ac() abort
let line = ['### issues']
call add(line, '')
call add(line, 'Achievements | Account')
call add(line, '----- | -----')
let acc = [100, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]
for id in acc
let issue = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', id)
if has_key(issue, 'id')
let is_pr = has_key(issue, 'pull_request')
call add(line, id . 'th issue(' . (is_pr ? 'PR' : 'issue') . ') | ' . issue.user.login)
else
break
endif
endfor
return line
endfunction
function! SpaceVim#dev#Achievements#update()
let [start, end] = s:find_position()
if start != 0 && end != 0
exe (start + 1) . ',' . (end - 1) . 'delete'
call append(start, s:generate_content())
endif
endfunction

View File

@ -1146,9 +1146,9 @@ Symbol | Description | Custom option
`✖` | Error | `g:spacevim_error_symbol`
`➤` | warning | `g:spacevim_warning_symbol`
<!-- SpaceVim Achievements -->
<!-- SpaceVim Achievements start -->
<!-- SpaceVim Achievements -->
<!-- SpaceVim Achievements end -->
## Features