mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +08:00
fix(git): add clean.vim
This commit is contained in:
parent
99e0262f12
commit
e40635a035
56
bundle/git.vim/autoload/git/clean.vim
vendored
Normal file
56
bundle/git.vim/autoload/git/clean.vim
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
""
|
||||||
|
" @section git-clean, clean
|
||||||
|
" @parentsection commands
|
||||||
|
" This commands is to run `git clean`.
|
||||||
|
" >
|
||||||
|
" :Git clean -f
|
||||||
|
" <
|
||||||
|
|
||||||
|
let s:JOB = SpaceVim#api#import('job')
|
||||||
|
let s:NOTI = SpaceVim#api#import('notify')
|
||||||
|
|
||||||
|
function! git#clean#run(argvs) abort
|
||||||
|
|
||||||
|
let cmd = ['git', 'clean'] + a:argvs
|
||||||
|
call git#logger#info('git-clean cmd:' . string(cmd))
|
||||||
|
call s:JOB.start(cmd,
|
||||||
|
\ {
|
||||||
|
\ 'on_stdout' : function('s:on_stdout'),
|
||||||
|
\ 'on_stderr' : function('s:on_stderr'),
|
||||||
|
\ 'on_exit' : function('s:on_exit'),
|
||||||
|
\ }
|
||||||
|
\ )
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
function! s:on_stdout(id, data, event) abort
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:on_stderr(id, data, event) abort
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:on_exit(id, data, event) abort
|
||||||
|
call git#logger#info('git-clean exit data:' . string(a:data))
|
||||||
|
if a:data ==# 0
|
||||||
|
call s:NOTI.notify('stage files done!')
|
||||||
|
else
|
||||||
|
call s:NOTI.notify('stage files failed!')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:options() abort
|
||||||
|
return join([
|
||||||
|
\ '-f',
|
||||||
|
\ '-n',
|
||||||
|
\ ], "\n")
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! git#clean#complete(ArgLead, CmdLine, CursorPos) abort
|
||||||
|
if a:ArgLead =~# '^-'
|
||||||
|
return s:options()
|
||||||
|
endif
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user