rustc-dev-guide icon indicating copy to clipboard operation
rustc-dev-guide copied to clipboard

use `&` to load completions for PowerShell

Open hycinth22 opened this issue 1 year ago • 1 comments

in src/building/suggested.md

You can use source ./src/etc/completions/x.py.<extension> to load completions for your shell of choice, or source .\src\etc\completions\x.py.ps1 for PowerShell.

to my best knowledge, there is no source command in powershell. it is available only in unix-like os. we should use call operator(&) to load .ps1 script file for powershell

hycinth22 avatar May 14 '24 17:05 hycinth22

Other choice we may have:

  1. Execute the filename directly: .\src\etc\completions\x.py.ps1 This is equivalent to call operator, but its semantics are not clear enough

  2. Invoke-Expression: Invoke-Expression -Command ".\src\etc\completions\x.py.ps1" too long and no obvious benefit

  3. Dot-Sourcing: . .\src\etc\completions\x.py.ps1 all definitions in the script will be import to the current session. we dont need so much

hycinth22 avatar May 14 '24 18:05 hycinth22

Is anyone going to review or discuss this?

hycinth22 avatar Jun 04 '24 05:06 hycinth22