Closed czhang03 closed 8 years ago
this works...
function HexoArgumentCompletion{
param($commandName, $wordToComplete, $commandAst, $fakeBoundParameter)
$command = 'hexo'
$HexoCommandList = @('help', 'init', 'version', 'new', 'ntest')
$HexoCommandList|ForEach-Object {
if("$command $_" -match "$wordToComplete *") {
New-CompletionResult -CompletionText $_
}
}
}
Register-ArgumentCompleter `
-Native `
-CommandName ('hexo', 'hexo.cmd') `
-ScriptBlock $function:HexoArgumentCompletion
but I don't know why...
I will open a new issue to state this
I was trying to write a completion for hexo.
I found out that the
$commandName
is null, the$parameterName
is what inputed. for example, if I writehexo ne<tab>
, $parameter name is'hexo ne'
the$wordToComplete
is the cursor position.I don't know why, is it related to the
-Native
parameter ofRegister-ArgumentCompleter
?