doc: update shellquote for powershell #11122

shellquote is not treated like shellxquote for non-quote values.
This commit is contained in:
Jan Edmund Lazo
2019-10-10 04:16:02 -04:00
committed by Justin M. Keyes
parent f2ad93168b
commit 51f2826f61
3 changed files with 30 additions and 3 deletions

View File

@@ -501,9 +501,20 @@ function module.source(code)
end
function module.set_shell_powershell()
local shell = iswin() and 'powershell' or 'pwsh'
if not module.eval('executable("'..shell..'")') then
error(shell..' is not executable')
end
local aliases = iswin() and {'cat', 'sleep'} or {}
local cmd = ''
for _, alias in ipairs(aliases) do
cmd = cmd .. 'Remove-Item -Force alias:' .. alias .. ';'
end
module.source([[
set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote=
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command Remove-Item -Force alias:sleep; Remove-Item -Force alias:cat;'
let &shell = ']]..shell..[['
set shellquote= shellpipe=\| shellxquote=
let &shellredir = '| Out-File -Encoding UTF8'
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ]]..cmd..[['
]])
end