fix: pwsh: custom history log
This commit is contained in:
parent
57b4300bd6
commit
907253b097
1 changed files with 5 additions and 1 deletions
|
@ -33,13 +33,17 @@ Set-Alias whereis where.exe
|
||||||
# change window name
|
# change window name
|
||||||
# save my history
|
# save my history
|
||||||
$My_Pwsh_History = "$HOME\my_pwsh_history.txt"
|
$My_Pwsh_History = "$HOME\my_pwsh_history.txt"
|
||||||
|
# shell starts
|
||||||
|
Write-Output "$(Get-Date -UFormat '+%Y-%m-%d %H:%M:%S') $env:COMPUTERNAME`:$PID [START]"
|
||||||
|
| Out-File -FilePath $My_Pwsh_History -Append -Encoding utf8
|
||||||
|
# save
|
||||||
function Invoke-Starship-PreCommand {
|
function Invoke-Starship-PreCommand {
|
||||||
# window title
|
# window title
|
||||||
$ParentFolder = Split-Path $PWD -Leaf
|
$ParentFolder = Split-Path $PWD -Leaf
|
||||||
$host.ui.Write("`e]0; $ParentFolder `a")
|
$host.ui.Write("`e]0; $ParentFolder `a")
|
||||||
|
|
||||||
# save log
|
# save log
|
||||||
Write-Output "$(Get-Date -UFormat '+%Y-%m-%d %H:%M:%S') $env:COMPUTERNAME`:$PID [$Global:LASTEXITCODE] $(Get-History -Count 1)"
|
Write-Output "$(Get-Date -UFormat '+%Y-%m-%d %H:%M:%S') $env:COMPUTERNAME`:$PID $PWD [$Global:LASTEXITCODE] $(Get-History -Count 1)"
|
||||||
| Out-File -FilePath $My_Pwsh_History -Append -Encoding utf8
|
| Out-File -FilePath $My_Pwsh_History -Append -Encoding utf8
|
||||||
}
|
}
|
||||||
Invoke-Expression (&starship init powershell)
|
Invoke-Expression (&starship init powershell)
|
||||||
|
|
Loading…
Reference in a new issue