WindowsAid.psm1
using namespace System.Management.Automation #region Public Cmdlets-Code ausführen Get-ChildItem "$PSScriptRoot\Public\*.ps1" -PipelineVariable cmdlet -Exclude '*.Tests.ps1' | ForEach-Object -Process { . $cmdlet.FullName } #endregion #region Argument Completer Register-ArgumentCompleter -Native -CommandName WinGet -ScriptBlock { param($wordToComplete, $commandAst, $cursorPosition) [Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new() $Local:word = $wordToComplete.Replace('"', '""') $Local:ast = $commandAst.ToString().Replace('"', '""') WinGet.exe complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } #endregion #region Aufräumarbeiten bei Remove-Module -Name AKPT $MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {} #endregion |