winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

Register-WingetdevAutoComplete.ps1 (600B)


      1 Register-ArgumentCompleter -Native -CommandName wingetdev -ScriptBlock {
      2     param($wordToComplete, $commandAst, $cursorPosition)
      3         [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
      4         $Local:word = $wordToComplete.Replace('"', '""')
      5         $Local:ast = $commandAst.ToString().Replace('"', '""')
      6         wingetdev complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
      7             [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
      8         }
      9 }