From e40635a03538f73e67e68a18c82c63fe1832e304 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sat, 19 Nov 2022 21:33:45 +0800 Subject: [PATCH] fix(git): add clean.vim --- bundle/git.vim/autoload/git/clean.vim | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 bundle/git.vim/autoload/git/clean.vim diff --git a/bundle/git.vim/autoload/git/clean.vim b/bundle/git.vim/autoload/git/clean.vim new file mode 100644 index 000000000..0fadc4a20 --- /dev/null +++ b/bundle/git.vim/autoload/git/clean.vim @@ -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 + +