Update windows/Microsoft.PowerShell_profile.ps1

added PS equivalent of dot alias
This commit is contained in:
theflyingfool 2024-06-09 17:48:29 -05:00
parent ef393be38d
commit c1b4b3933b

View File

@ -1,14 +1,19 @@
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
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 {
param([string[]]$args)
& git --git-dir=$env:USERPROFILE\.dot --work-tree=$env:USERPROFILE $args
}