1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:20:05 +08:00

fix(git): add clean.vim

This commit is contained in:
wsdjeg 2022-11-19 21:33:45 +08:00
parent 99e0262f12
commit e40635a035

56
bundle/git.vim/autoload/git/clean.vim vendored Normal file
View 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