vcomplete: add powershell support (#9093)

pull/9100/head
Stanislav Ershov 2021-03-04 03:57:08 +05:00 committed by GitHub
parent 0f8f8bd90d
commit 76c8dea782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -29,7 +29,13 @@
// ``` // ```
// Please note that you should let v load the zsh completions after the call to compinit // Please note that you should let v load the zsh completions after the call to compinit
// //
// # powershell //TODO // # powershell
// To install auto-complete for V in PowerShell, simply do this
// `v complete setup powershell >> $PROFILE`
// and reload profile
// `& $PROFILE`
// If `$PROFILE` didn't exist yet, create it before
// `New-Item -Type File -Force $PROFILE`
// //
module main module main
@ -248,7 +254,14 @@ _v() {
} }
compdef _v v compdef _v v
' } ' }
// 'powershell' {} //TODO 'powershell' { setup = '
Register-ArgumentCompleter -Native -CommandName v -ScriptBlock {
param(\$commandName, \$wordToComplete, \$cursorPosition)
$vexe complete powershell "\$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new(\$_, \$_, \'ParameterValue\', \$_)
}
}
' }
else {} else {}
} }
println(setup) println(setup)
@ -264,7 +277,7 @@ compdef _v v
} }
println(lines.join('\n')) println(lines.join('\n'))
} }
'fish' { 'fish', 'powershell' {
if sub_args.len <= 1 { if sub_args.len <= 1 {
exit(0) exit(0)
} }
@ -286,7 +299,6 @@ compdef _v v
} }
println(lines.join('\n')) println(lines.join('\n'))
} }
// 'powershell' {} //TODO
else {} else {}
} }
exit(0) exit(0)