add: pwsh: save my custom history

This commit is contained in:
qwjyh 2022-10-17 17:34:30 +09:00
parent 745234408a
commit 9fef6bf5be

View file

@ -31,9 +31,16 @@ Set-Alias whereis where.exe
# starship
# change window name
# save my history
$My_Pwsh_History = "$HOME\my_pwsh_history.txt"
function Invoke-Starship-PreCommand {
# window title
$ParentFolder = Split-Path $PWD -Leaf
$host.ui.Write("`e]0; $ParentFolder `a")
# save log
Write-Output "$(Get-Date -UFormat '+%Y-%m-%d %H:%M:%S') $env:COMPUTERNAME`:$PID [$Global:LASTEXITCODE] $(Get-History -Count 1)"
| Out-File -FilePath $My_Pwsh_History -Append -Encoding utf8
}
Invoke-Expression (&starship init powershell)
$ENV:STARSHIP_CONFIG = "$HOME\.config\starship.toml"