From d247df9a90d6a23a74298b3d4a438ad2fc64f5cf Mon Sep 17 00:00:00 2001 From: Martin Blazik Date: Thu, 1 Oct 2020 19:33:19 +0200 Subject: [PATCH] Add Add-Runtime to PowerShell --- conf/Microsoft.PowerShell_profile.ps1 | 6 ++++-- scripts/powershell-install.sh | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/conf/Microsoft.PowerShell_profile.ps1 b/conf/Microsoft.PowerShell_profile.ps1 index c69baa5..6486964 100644 --- a/conf/Microsoft.PowerShell_profile.ps1 +++ b/conf/Microsoft.PowerShell_profile.ps1 @@ -3,7 +3,9 @@ Set-Alias ps Get-Process Set-Alias kill Stop-Process -function uptime() { - ((Get-Date) - (gcim Win32_OperatingSystem).LastBootUpTime) +# ex: ps *mosh* | Add-Runtime | ft Name,StartTime,Status + +filter Add-Runtime { + $_ | Add-Member -PassThru -NotePropertyName Status -NotePropertyValue (New-TimeSpan -Start $_.StartTime) } diff --git a/scripts/powershell-install.sh b/scripts/powershell-install.sh index ba57b17..f1b6dab 100755 --- a/scripts/powershell-install.sh +++ b/scripts/powershell-install.sh @@ -1,7 +1,8 @@ #!/bin/bash +set -e +set -u set -x -set -o PWSH_PROFILE_NAME=Microsoft.PowerShell_profile.ps1 PWSH_PROFILE_PATH=$HOME/.config/powershell/