dotfiles/windows/Microsoft.PowerShell_profile.ps1

16 lines
778 B
PowerShell
Raw Normal View History

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 complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
function touch($file) {
"" | Out-File $file -Encoding ASCII
}
function dot { & git --git-dir="C:\Users\User/.dot/" --work-tree="C:\Users\User" @args }