From cdd58bc167937924f47611bbbcc64a342cc44fd5 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 08:24:33 +0200 Subject: [PATCH] update pwsh style --- src/Certificate/Test-CSCertificate.ps1 | 2 +- src/Connection/Test-CSConnection.ps1 | 10 +--------- src/Item/Test-CredentialStoreItem.ps1 | 5 +++-- src/Private/Get-ModuleBase.ps1 | 3 ++- src/Private/Get-TempDir.ps1 | 13 +++++++++---- src/Private/Import-CSPfxCertificate.ps1 | 2 +- src/Private/Test-CSPfxCertificate.ps1 | 2 +- src/Private/Test-Module.ps1 | 3 ++- src/Store/New-CredentialStore.ps1 | 3 +-- src/Store/Test-CredentialStore.ps1 | 2 +- 10 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/Certificate/Test-CSCertificate.ps1 b/src/Certificate/Test-CSCertificate.ps1 index 6a7d0e2..ed9b45f 100644 --- a/src/Certificate/Test-CSCertificate.ps1 +++ b/src/Certificate/Test-CSCertificate.ps1 @@ -21,7 +21,7 @@ function Test-CSCertificate { [CmdletBinding()] [OutputType([bool])] - param( + param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [ValidateSet('Private', 'Shared')] diff --git a/src/Connection/Test-CSConnection.ps1 b/src/Connection/Test-CSConnection.ps1 index d37400e..f33f14f 100644 --- a/src/Connection/Test-CSConnection.ps1 +++ b/src/Connection/Test-CSConnection.ps1 @@ -21,14 +21,6 @@ function Test-CSConnection { .EXAMPLE Test-CMConnection -RemoteHost "vcr01.internal.net" -Type VMware - - .NOTES - - File Name : Test-CSConnection.ps1 - - Author : Marco Blessing - marco.blessing@googlemail.com - - Requires : - - .LINK - https://github.com/OCram85/PSCredentialStore #> [CmdletBinding()] @@ -38,7 +30,7 @@ function Test-CSConnection { [ValidateNotNullOrEmpty()] [string]$RemoteHost, - [Parameter(Mandatory = $True)] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")] [string]$Type diff --git a/src/Item/Test-CredentialStoreItem.ps1 b/src/Item/Test-CredentialStoreItem.ps1 index cb7a205..d516f6f 100644 --- a/src/Item/Test-CredentialStoreItem.ps1 +++ b/src/Item/Test-CredentialStoreItem.ps1 @@ -29,13 +29,14 @@ function Test-CredentialStoreItem { [None] .EXAMPLE - If (Test-CredentialStoreItem -RemoteHost "Default") { + if (Test-CredentialStoreItem -RemoteHost "Default") { Get-CredentialStoreItem -RemoteHost "Default" } - Else { + else { Write-Warning ("The given Remote Host {0} does not exist in the credential Store!" -f $RemoteHost) } #> + [CmdletBinding(DefaultParameterSetName = 'Private')] [OutputType([bool])] param ( diff --git a/src/Private/Get-ModuleBase.ps1 b/src/Private/Get-ModuleBase.ps1 index 968f54b..9f8392c 100644 --- a/src/Private/Get-ModuleBase.ps1 +++ b/src/Private/Get-ModuleBase.ps1 @@ -8,7 +8,8 @@ function Get-ModuleBase { .OUTPUTS Returns the base path as string -#> + #> + [CmdletBinding()] [OutputType([string])] param () diff --git a/src/Private/Get-TempDir.ps1 b/src/Private/Get-TempDir.ps1 index 9406698..59a7311 100644 --- a/src/Private/Get-TempDir.ps1 +++ b/src/Private/Get-TempDir.ps1 @@ -14,12 +14,13 @@ function Get-TempDir { .EXAMPLE Get-TempDir #> + [CmdletBinding()] [OutputType([string])] param () begin {} - + process { if ($IsLinux) { return (Resolve-Path -Path '/tmp/').Path @@ -27,10 +28,14 @@ function Get-TempDir { if ($IsMacOS) { return (Resolve-Path -Path '/tmp/').Path } - elseif (($isWindows) -or ($PSVersionTable.PSVersion.Major -lt 6) -or ($PSVersionTable.PSEdition -eq 'Desktop')) { + elseif ( + ($isWindows) -or + ($PSVersionTable.PSVersion.Major -lt 6) -or + ($PSVersionTable.PSEdition -eq 'Desktop') + ) { return (Resolve-Path -Path $env:TEMP).Path } } - end { - } + + end {} } diff --git a/src/Private/Import-CSPfxCertificate.ps1 b/src/Private/Import-CSPfxCertificate.ps1 index eb9f93f..f1decc3 100644 --- a/src/Private/Import-CSPfxCertificate.ps1 +++ b/src/Private/Import-CSPfxCertificate.ps1 @@ -70,7 +70,7 @@ function Import-CSPfxCertificate { $_.Exception.Message | Write-Error -ErrorAction Stop } } - + process { try { $cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new( diff --git a/src/Private/Test-CSPfxCertificate.ps1 b/src/Private/Test-CSPfxCertificate.ps1 index da7575e..64c427b 100644 --- a/src/Private/Test-CSPfxCertificate.ps1 +++ b/src/Private/Test-CSPfxCertificate.ps1 @@ -27,7 +27,7 @@ function Test-CSPfxCertificate { [CmdletBinding()] [OutputType([bool])] - param( + param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true)] [ValidateNotNullOrEmpty()] [string]$Thumbprint, diff --git a/src/Private/Test-Module.ps1 b/src/Private/Test-Module.ps1 index 61ed158..67cbba1 100644 --- a/src/Private/Test-Module.ps1 +++ b/src/Private/Test-Module.ps1 @@ -33,9 +33,10 @@ function Test-Module { .EXAMPLE .\Test-Dependency -Name 'VMware.PowerCLI' -Type 'Module' -StopIfFails #> + [OutputType([bool])] [CmdletBinding()] - param( + param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$Name, diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index effdeed..d18433a 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -242,6 +242,5 @@ function New-CredentialStore { } } - end { - } + end {} } diff --git a/src/Store/Test-CredentialStore.ps1 b/src/Store/Test-CredentialStore.ps1 index 20486e5..e535b06 100644 --- a/src/Store/Test-CredentialStore.ps1 +++ b/src/Store/Test-CredentialStore.ps1 @@ -16,8 +16,8 @@ function Test-CredentialStore { .EXAMPLE Test-CredentialStore -eq $true - #> + [CmdletBinding(DefaultParameterSetName = 'Private')] [OutputType([bool])] param (