From 3b3918dc22f302faac37e04d643939a05861ff0d Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 26 Jun 2023 15:16:30 +0100 Subject: [PATCH] Run through PowerShell formatter --- .../files/Microsoft.PowerShell_profile.ps1 | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 index 984f7af..7d9225c 100644 --- a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 +++ b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 @@ -25,8 +25,9 @@ function Prompt { } function ADUserInfo { - Param ( - [Parameter(Mandatory=$true)] [string]$User + param ( + [Parameter(Mandatory)] + [string]$User ) Import-Module ActiveDirectory -ErrorAction Stop $ADPropertiesCommon = @( @@ -54,7 +55,7 @@ function ADUserInfo { 'msDS-UserPasswordExpiryTimeComputed' ) $ADPropertiesPrintOnly = @( - @{Name="PasswordExpiresDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} + @{Name = "PasswordExpiresDate"; Expression = { [datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed") } } ) $ADPropertiesGet = $ADPropertiesCommon + $ADPropertiesGetOnly $ADPropertiesPrint = $ADPropertiesCommon + $ADPropertiesPrintOnly @@ -62,8 +63,9 @@ function ADUserInfo { } Function mkcd { - Param ( - [Parameter(Mandatory=$true,Position=0)] [string]$Path + param ( + [Parameter(Mandatory)] + [string]$Path ) New-Item -ItemType Directory -Path $Path Set-Location -Path $Path @@ -87,24 +89,24 @@ Set-PSReadLineKeyHandler -Chord Ctrl+RightArrow -Function ForwardWord Set-PSReadLineKeyHandler -Chord Ctrl+Backspace -Function BackwardKillWord Set-PSReadLineKeyHandler -Chord Ctrl+Delete -Function KillWord -if ($PSVersionTable.PSVersion -ge [System.Version]"7.2") { +if ($PSVersionTable.PSVersion -ge [System.Version]"7.2.0.0") { $AnsiReset = "`e[0m" Set-PSReadLineOption -Colors @{ - Default = $AnsiReset; - Command = $AnsiReset; - Comment = $AnsiReset; + Default = $AnsiReset; + Command = $AnsiReset; + Comment = $AnsiReset; ContinuationPrompt = $AnsiReset; - Emphasis = $AnsiReset; - Error = $AnsiReset; - InlinePrediction = $AnsiReset; - Keyword = $AnsiReset; - Member = $AnsiReset; - Number = $AnsiReset; - Operator = $AnsiReset; - Parameter = $AnsiReset; - Selection = $AnsiReset; - String = $AnsiReset; - Type = $AnsiReset; - Variable = $AnsiReset; + Emphasis = $AnsiReset; + Error = $AnsiReset; + InlinePrediction = $AnsiReset; + Keyword = $AnsiReset; + Member = $AnsiReset; + Number = $AnsiReset; + Operator = $AnsiReset; + Parameter = $AnsiReset; + Selection = $AnsiReset; + String = $AnsiReset; + Type = $AnsiReset; + Variable = $AnsiReset; } }