mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 06:20:05 +08:00
Add func for report issue
This commit is contained in:
parent
ae1860b0d6
commit
57597072bd
@ -1,35 +1,55 @@
|
|||||||
function! SpaceVim#issue#report() abort
|
function! SpaceVim#issue#report() abort
|
||||||
call s:open()
|
call s:open()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:open() abort
|
function! s:open() abort
|
||||||
exe 'tabnew ' . tempname() . '/issue_report.md'
|
exe 'tabnew ' . tempname() . '/issue_report.md'
|
||||||
call setline(1, s:template())
|
let b:spacevim_issue_template = 1
|
||||||
w
|
call setline(1, s:template())
|
||||||
|
w
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:template() abort
|
function! s:template() abort
|
||||||
let info = [
|
let info = [
|
||||||
\ '<!-- please remove the issue template when request for a feature -->',
|
\ '<!-- please remove the issue template when request for a feature -->',
|
||||||
\ '## Expected behavior, english is recommend',
|
\ '## Expected behavior, english is recommend',
|
||||||
\ '',
|
\ '',
|
||||||
\ '## Environment Information',
|
\ '## Environment Information',
|
||||||
\ '',
|
\ '',
|
||||||
\ '- OS:' . SpaceVim#api#import('system').name(),
|
\ '- OS:' . SpaceVim#api#import('system').name(),
|
||||||
\ '- vim version:' . (has('nvim') ? '' : v:version),
|
\ '- vim version:' . (has('nvim') ? '' : v:version),
|
||||||
\ '- neovim version:' . (has('nvim') ? v:version : ''),
|
\ '- neovim version:' . (has('nvim') ? v:version : ''),
|
||||||
\ '',
|
\ '',
|
||||||
\ '## The reproduce ways from Vim starting (Required!)',
|
\ '## The reproduce ways from Vim starting (Required!)',
|
||||||
\ '',
|
\ '',
|
||||||
\ '## Output of the `:SPDebugInfo!`',
|
\ '## Output of the `:SPDebugInfo!`',
|
||||||
\ '']
|
\ '']
|
||||||
\ + split(SpaceVim#api#import('vim#compatible').execute(':SPDebugInfo'), "\n") +
|
\ + split(SpaceVim#api#import('vim#compatible').execute(':SPDebugInfo'), "\n") +
|
||||||
\ [
|
\ [
|
||||||
\ '## Screenshots',
|
\ '## Screenshots',
|
||||||
\ '',
|
\ '',
|
||||||
\ 'If you have any screenshots for this issue please upload here. BTW you can use https://asciinema.org/ for recording video in terminal.'
|
\ '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
|
return info
|
||||||
endfunction
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user