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

Add func for report issue

This commit is contained in:
wsdjeg 2017-11-27 19:53:11 +08:00
parent ae1860b0d6
commit 57597072bd

View File

@ -1,35 +1,55 @@
function! SpaceVim#issue#report() abort
call s:open()
call s:open()
endfunction
function! s:open() abort
exe 'tabnew ' . tempname() . '/issue_report.md'
call setline(1, s:template())
w
exe 'tabnew ' . tempname() . '/issue_report.md'
let b:spacevim_issue_template = 1
call setline(1, s:template())
w
endfunction
function! s:template() abort
let info = [
\ '<!-- please remove the issue template when request for a feature -->',
\ '## Expected behavior, english is recommend',
\ '',
\ '## Environment Information',
\ '',
\ '- OS:' . SpaceVim#api#import('system').name(),
\ '- vim version:' . (has('nvim') ? '' : v:version),
\ '- neovim version:' . (has('nvim') ? v:version : ''),
\ '',
\ '## The reproduce ways from Vim starting (Required!)',
\ '',
\ '## Output of the `:SPDebugInfo!`',
\ '']
\ + split(SpaceVim#api#import('vim#compatible').execute(':SPDebugInfo'), "\n") +
\ [
\ '## Screenshots',
\ '',
\ 'If you have any screenshots for this issue please upload here. BTW you can use https://asciinema.org/ for recording video in terminal.'
\ ]
return info
let info = [
\ '<!-- please remove the issue template when request for a feature -->',
\ '## Expected behavior, english is recommend',
\ '',
\ '## Environment Information',
\ '',
\ '- OS:' . SpaceVim#api#import('system').name(),
\ '- vim version:' . (has('nvim') ? '' : v:version),
\ '- neovim version:' . (has('nvim') ? v:version : ''),
\ '',
\ '## The reproduce ways from Vim starting (Required!)',
\ '',
\ '## Output of the `:SPDebugInfo!`',
\ '']
\ + split(SpaceVim#api#import('vim#compatible').execute(':SPDebugInfo'), "\n") +
\ [
\ '## Screenshots',
\ '',
\ 'If you have any screenshots for this issue please upload here. BTW you can use https://asciinema.org/ for recording video in terminal.'
\ ]
return info
endfunction
function! SpaceVim#issue#new()
if get(b:, 'spacevim_issue_template', 0) == 1
let title = input('Issue title:')
let username = input('github username:')
let password = input('github password:')
let issue = {'title' : title,
\ 'body' : join(getline(1, '$'), "\n"),
\ }
let response = github#api#issues#Create('SpaceVim', 'SpaceVim', username, password, issue)
let g:wsd = response
if has_key(response, 'html_url')
echo 'Issue created done: ' . response.html_url
else
echo 'Failed to create issue, please check the username and password'
endif
endif
endfunction