summaryrefslogtreecommitdiff
path: root/scripts/register-completions.ps1
blob: bae3281f80b348b8ad1d016c38571e4badb5c173 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# PowerShell parameter completion shim for xmake

Register-ArgumentCompleter -Native -CommandName xmake -ScriptBlock {
    param($commandName, $wordToComplete, $cursorPosition)
    $complete = "$wordToComplete"
    if (-not $commandName) {
        $complete = $complete + " "
    }
    $oldenv = $env:XMAKE_SKIP_HISTORY
    $env:XMAKE_SKIP_HISTORY = 1
    xmake lua private.utils.complete "0" "$complete" | ForEach-Object {
        [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
    }
    $env:XMAKE_SKIP_HISTORY = $oldenv
}