carapace-sh / carapace-bin

multi-shell multi-command argument completer
https://carapace.sh
MIT License
957 stars 52 forks source link

carapace _caraspace | Out-String | Invoke-Expression #2409

Open pa-0 opened 5 months ago

pa-0 commented 5 months ago

Current Behavior

When PowerShell attempts to load the default $PROFILE, the following error is returned:

expected one of 'bash', 'bash-ble', 'elvish', 'export', 'fish', 'ion', 'nushell', 'oil', 'powershell', 'tcsh', 'xonsh', 'zsh' [was: ]
Invoke-Expression: C:\Users\XXXX\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:266
Line |
 266 |  carapace _carapace | Out-String | Invoke-Expression
     |                                    ~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'Command' because it is an empty string.
Loading personal and system profiles took 24758ms.

Expected Behavior

The $PROFILE loads correctly.

Steps To Reproduce

  1. Follow carapace setup instructions exactly after running winget install from Admin prompt.
  2. Copy and paste code block into default "...PowerShell_profile.ps1" file.
  3. Run PowerShell.

Version

7.5.0-preview.3

OS

Shell

Anything else?

~/.config/powershell/Microsoft.PowerShell_profile.ps1

$env:CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional Set-PSReadLineOption -Colors @{ "Selection" = "`e[7m" } Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete carapace _carapace | Out-String | Invoke-Expression



And now that I'm reading it, I'm thinking that optional line does not apply since I do not have zsh, fish or inshellisense installed. 🤦🏽‍♂️ 
pa-0 commented 5 months ago

I take that back, removing the optional line makes no difference.

rsteube commented 5 months ago

Does this work?

carapace _carapace powershell | Out-String | Invoke-Expression
rsteube commented 5 months ago

Oh and are you on a recent Powershell 7 version?

pa-0 commented 5 months ago

Yes. Newest preview release.