add: pwsh: save my custom history
This commit is contained in:
parent
745234408a
commit
9fef6bf5be
1 changed files with 7 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue