You've already forked inshellisense
mirror of
https://github.com/wavetermdev/inshellisense.git
synced 2026-04-22 15:25:33 -07:00
c13939ae02
* feat: add option to hide prompt information during e2e tests Signed-off-by: Chapman Pendery <cpendery@vt.edu> * fix: drop hidden option header Signed-off-by: Chapman Pendery <cpendery@vt.edu> * fix: tests to use -T Signed-off-by: Chapman Pendery <cpendery@vt.edu> --------- Signed-off-by: Chapman Pendery <cpendery@vt.edu>
24 lines
772 B
PowerShell
24 lines
772 B
PowerShell
$Global:__IsOriginalPrompt = $function:Prompt
|
|
|
|
function Global:__IsTestingPrompt() {
|
|
return "PS > "
|
|
}
|
|
if ($env:ISTERM_TESTING -eq "1") {
|
|
$Global:__IsOriginalPrompt = $function:__IsTestingPrompt
|
|
}
|
|
|
|
function Global:__IS-Escape-Value([string]$value) {
|
|
[regex]::Replace($value, '[\\\n;]', { param($match)
|
|
-Join (
|
|
[System.Text.Encoding]::UTF8.GetBytes($match.Value) | ForEach-Object { '\x{0:x2}' -f $_ }
|
|
)
|
|
})
|
|
}
|
|
|
|
function Global:Prompt() {
|
|
$Result = "$([char]0x1b)]6973;PS`a"
|
|
$Result += $Global:__IsOriginalPrompt.Invoke()
|
|
$Result += "$([char]0x1b)]6973;PE`a"
|
|
$Result += if ($pwd.Provider.Name -eq 'FileSystem') { "$([char]0x1b)]6973;CWD;$(__IS-Escape-Value $pwd.ProviderPath)`a" }
|
|
return $Result
|
|
} |