mirror of
https://github.com/ViViDboarder/vim-abuse-the-force.git
synced 2024-11-27 02:56:36 +00:00
Add support for using Vim-Dispatch for async deploys
This commit is contained in:
parent
1d9702315d
commit
764a47ee01
@ -1,28 +1,29 @@
|
|||||||
|
|
||||||
|
if !exists("g:abusetheforce_dispatch_background")
|
||||||
|
let g:abusetheforce_dispatch_background = 0
|
||||||
|
end
|
||||||
|
|
||||||
function! AbuseTheForceDeploy()
|
function! AbuseTheForceDeploy()
|
||||||
let filePath = expand("%")
|
let filePath = expand("%")
|
||||||
|
|
||||||
"let command = "!echo \"" . filePath . "\""
|
let command = "abusetheforce deploy file \"" . filePath . "\""
|
||||||
let command = "!abusetheforce deploy file \"" . filePath . "\""
|
call AbuseTheForceTryStart(command)
|
||||||
execute command
|
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! AbuseTheForceDeployTest()
|
function! AbuseTheForceDeployTest()
|
||||||
let filePath = expand("%")
|
let filePath = expand("%")
|
||||||
|
|
||||||
"let command = "!echo \"" . filePath . "\""
|
let command = "abusetheforce deploy test \"" . filePath . "\""
|
||||||
let command = "!abusetheforce deploy test \"" . filePath . "\""
|
call AbuseTheForceTryStart(command)
|
||||||
execute command
|
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! AbuseTheForceRetrieve()
|
function! AbuseTheForceRetrieve()
|
||||||
let filePath = expand("%")
|
let filePath = expand("%")
|
||||||
|
|
||||||
"let command = "!echo \"" . filePath . "\""
|
let command = "abusetheforce retrieve file \"" . filePath . "\""
|
||||||
let command = "!abusetheforce retrieve file \"" . filePath . "\""
|
call AbuseTheForceTryStart(command)
|
||||||
execute command
|
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -31,16 +32,43 @@ function! AbuseTheForceTarget(...)
|
|||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
|
|
||||||
if a:1 == "?"
|
if a:1 == "?"
|
||||||
let command = "!abusetheforce target list"
|
let command = "abusetheforce target list"
|
||||||
else
|
else
|
||||||
let target = a:1
|
let target = a:1
|
||||||
|
|
||||||
let command = "!abusetheforce target activate \"" . target . "\""
|
let command = "abusetheforce target activate \"" . target . "\""
|
||||||
|
end
|
||||||
|
else
|
||||||
|
let command = "abusetheforce target"
|
||||||
|
end
|
||||||
|
|
||||||
|
if exists("l:command")
|
||||||
|
call AbuseTheForceTryStart(command)
|
||||||
|
end
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Try to run the command using vim-dispatch
|
||||||
|
" (https://github.com/tpope/vim-dispatch)
|
||||||
|
function! AbuseTheForceTryStart(...)
|
||||||
|
|
||||||
|
" Make sure we have a parameter
|
||||||
|
if a:0 > 0
|
||||||
|
let command = a:1
|
||||||
|
|
||||||
|
if exists(":Dispatch")
|
||||||
|
" Determine foreground or background
|
||||||
|
if g:abusetheforce_dispatch_background == 1
|
||||||
|
let fgbg = "! "
|
||||||
|
else
|
||||||
|
let fgbg = " "
|
||||||
|
end
|
||||||
|
|
||||||
|
let command = "Dispatch" . fgbg . command
|
||||||
|
else
|
||||||
|
let command = "!" . command
|
||||||
end
|
end
|
||||||
|
|
||||||
execute command
|
|
||||||
else
|
|
||||||
let command = "!abusetheforce target"
|
|
||||||
execute command
|
execute command
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user