Skip to content

Commit

Permalink
fix powershell bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lasantosr committed May 16, 2023
1 parent 37d5650 commit 5150c1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Like IntelliSense, but for shells!
IntelliShell acts like a bookmark store for commands, so you don't have to keep your history clean in order to be able
to find something useful with `ctrl + R`.

It currently works on Bash, Zsh and Fish and should be compatible with most Linux, Windows and MacOS.
It currently works on Bash, Zsh, Fish and PowerShell and should be compatible with most Linux, Windows and MacOS.

## TL;DR

Expand Down
1 change: 1 addition & 0 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ if (($null -eq $ProfileContent) -Or ($ProfileContent -NotLike "*IntelliShell*"))
Add-Content $Profile "# `$env:INTELLI_LABEL_HOTKEY = 'Ctrl+l'"
Add-Content $Profile ". `$env:APPDATA\IntelliShell\Intelli-Shell\bin\intelli-shell.ps1"
}
Write-Host "Close this terminal and open a new one for the changes to take effect"
9 changes: 6 additions & 3 deletions intelli-shell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Set-PSReadLineKeyHandler -Chord $IntelliSearchChord -BriefDescription "IntelliSh
$TempFile = New-TemporaryFile
$line = $line -replace '"','""""""""""""'
$Command = 'intelli-shell.exe --file-output=""""' + $TempFile.FullName + '"""" search """"' + $line + '""""'
Start-Process powershell.exe -Wait -NoNewWindow -ArgumentList "-command ""$Command""" -RedirectStandardError "NUL"
Start-Process powershell.exe -Wait -NoNewWindow -ArgumentList "-command", "$Command" -RedirectStandardError "NUL"
$IntelliOutput = Get-Content -Raw $TempFile
Remove-Item $TempFile

Expand All @@ -30,7 +30,10 @@ Set-PSReadLineKeyHandler -Chord $IntelliBookmarkChord -BriefDescription "Intelli
$TempFile = New-TemporaryFile
$line = $line -replace '"','""""""""""""'
$Command = 'intelli-shell.exe --file-output=""""' + $TempFile.FullName + '"""" new -c """"' + $line + '""""'
Start-Process powershell.exe -Wait -NoNewWindow -ArgumentList "-command ""$Command""" -RedirectStandardError "NUL"
if ([string]::IsNullOrWhiteSpace($line)) {
$Command = 'intelli-shell.exe --file-output=""""' + $TempFile.FullName + '"""" new'
}
Start-Process powershell.exe -Wait -NoNewWindow -ArgumentList "-command", "$Command" -RedirectStandardError "NUL"
$IntelliOutput = Get-Content -Raw $TempFile
Remove-Item $TempFile

Expand All @@ -50,7 +53,7 @@ Set-PSReadLineKeyHandler -Chord $IntelliLabelChord -BriefDescription "IntelliShe
$TempFile = New-TemporaryFile
$line = $line -replace '"','""""""""""""'
$Command = 'intelli-shell.exe --file-output=""""' + $TempFile.FullName + '"""" label """"' + $line + '""""'
Start-Process powershell.exe -Wait -NoNewWindow -ArgumentList "-command ""$Command""" -RedirectStandardError "NUL"
Start-Process powershell.exe -Wait -NoNewWindow -ArgumentList "-command", "$Command" -RedirectStandardError "NUL"
$IntelliOutput = Get-Content -Raw $TempFile
Remove-Item $TempFile

Expand Down

0 comments on commit 5150c1f

Please sign in to comment.