Skip to content

Commit 58c33fc

Browse files
committed
Additional file formatting
1 parent 615f78f commit 58c33fc

File tree

85 files changed

+122
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+122
-124
lines changed

Build.ps1

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,35 @@ $manifestPath = "./Logic.Monitor.psd1"
66
$publicFuncFolderPath = './Public'
77

88
$ps1xmlFiles = Get-ChildItem -Path ./ -Filter *.ps1xml
9-
foreach ($ps1xml in $ps1xmlFiles) {
9+
Foreach ($ps1xml in $ps1xmlFiles) {
1010
[xml]$xml = Get-Content -Path $ps1xml.FullName
1111
$null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Format.xsd')
1212
$null = $xml.Schemas.Add($null, 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/src/Schemas/Types.xsd')
13-
$xml.Validate( { throw "File '$($ps1xml.Name)' schema error: $($_.Message)" })
13+
$xml.Validate( { Throw "File '$($ps1xml.Name)' schema error: $($_.Message)" })
1414
}
1515

16-
if (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) {
16+
If (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) {
1717
Install-PackageProvider -Name NuGet -Force | Out-Null
1818
}
1919
Import-PackageProvider -Name NuGet -Force | Out-Null
2020

21-
if ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') {
21+
If ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') {
2222
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
2323
}
2424

25-
if (!(Get-Module Microsoft.PowerShell.SecretManagement -ListAvailable)) {
25+
If (!(Get-Module Microsoft.PowerShell.SecretManagement -ListAvailable)) {
2626
Install-Module Microsoft.PowerShell.SecretManagement -Force -Confirm:$false
2727
}
28-
if (!(Get-Module Microsoft.PowerShell.SecretStore -ListAvailable)) {
28+
If (!(Get-Module Microsoft.PowerShell.SecretStore -ListAvailable)) {
2929
Install-Module Microsoft.PowerShell.SecretStore -Force -Confirm:$false
3030
}
3131

3232
$manifestContent = (Get-Content -Path $manifestPath -Raw) -replace '<ModuleVersion>', $buildVersion
3333

34-
if ((Test-Path -Path $publicFuncFolderPath) -and ($publicFunctionNames = Get-ChildItem -Path $publicFuncFolderPath -Filter '*.ps1' | Select-Object -ExpandProperty BaseName)) {
34+
If ((Test-Path -Path $publicFuncFolderPath) -and ($publicFunctionNames = Get-ChildItem -Path $publicFuncFolderPath -Filter '*.ps1' | Select-Object -ExpandProperty BaseName)) {
3535
$funcStrings = "'$($publicFunctionNames -join "','")'"
3636
}
37-
else {
37+
Else {
3838
$funcStrings = $null
3939
}
4040

EXAMPLES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Set-LMDevice -Name "192.168.1.1" -DisplayName $deviceProperty
192192
#Method Three
193193
#Using Get-LMDeviceGroupDevices to retrieve a list of devices and loop through each and set the sysname value to the displayname
194194
$devices = Get-LMDeviceGroupDevices -Name "Cambium Wireless"
195-
foreach ($dev in $devices) {
195+
Foreach ($dev in $devices) {
196196
$deviceProperty = ($dev.systemProperties[$dev.systemProperties.name.IndexOf("system.sysname")].value)
197197
if($deviceProperty -and $dev.systemProperties.name.IndexOf("system.sysname") -ne -1){
198198
Set-LMDevice -Id $dev.id -DisplayName $deviceProperty
@@ -209,7 +209,7 @@ $processedDeviceList = @()
209209
$devices = Get-LMDeviceGroupDevices -Id "23"
210210
211211
#Loop through each device and check for presence of property
212-
foreach ($dev in $devices) {
212+
Foreach ($dev in $devices) {
213213
$propName = "test.prop"
214214
$propValue = "1234"
215215
$currentPropValue = ($dev.customProperties[$dev.customProperties.name.IndexOf($propName)].value)

Private/Add-ObjectTypeInfo.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function Add-ObjectTypeInfo {
9696
http://blogs.microsoft.co.il/scriptfanatic/2012/04/13/custom-objects-default-display-in-powershell-30/
9797
#>
9898
[CmdletBinding()]
99-
param(
99+
Param (
100100
[Parameter( Mandatory = $true,
101101
Position = 0,
102102
ValueFromPipeline = $true )]
@@ -121,17 +121,17 @@ function Add-ObjectTypeInfo {
121121
)
122122

123123
Begin {
124-
if ($PSBoundParameters.ContainsKey('DefaultProperties')) {
124+
If ($PSBoundParameters.ContainsKey('DefaultProperties')) {
125125
# define a subset of properties
126126
$ddps = New-Object System.Management.Automation.PSPropertySet DefaultDisplayPropertySet, $DefaultProperties
127127
$PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]$ddps
128128
}
129129
}
130130
Process {
131-
foreach ($Object in $InputObject) {
131+
Foreach ($Object in $InputObject) {
132132
switch ($PSBoundParameters.Keys) {
133133
'PropertyToAdd' {
134-
foreach ($Key in $PropertyToAdd.Keys) {
134+
Foreach ($Key in $PropertyToAdd.Keys) {
135135
#Add some noteproperties. Slightly faster than Add-Member.
136136
$Object.PSObject.Properties.Add( ( New-Object PSNoteProperty($Key, $PropertyToAdd[$Key]) ) )
137137
}
@@ -145,7 +145,7 @@ function Add-ObjectTypeInfo {
145145
Add-Member -InputObject $Object -MemberType MemberSet -Name PSStandardMembers -Value $PSStandardMembers
146146
}
147147
}
148-
if ($Passthru) {
148+
If ($Passthru) {
149149
$Object
150150
}
151151
}

Private/Format-LMFilter-v1.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
System.String. The function returns a string that represents the formatted filter.
2525
2626
.NOTES
27-
The function does not throw any errors. If a property in the Filter parameter is not in the PropList parameter, it is simply removed from the filter.
27+
If a property in the Filter parameter is not in the PropList parameter, it is simply removed from the filter.
2828
#>
2929
Function Format-LMFilter-v1 {
3030
[CmdletBinding()]
@@ -48,7 +48,7 @@ Function Format-LMFilter-v1 {
4848
}
4949

5050
#Create filter string from hash table and url encode
51-
foreach ($Key in $($Filter.keys)) {
51+
Foreach ($Key in $($Filter.keys)) {
5252
$FilterString += $Key + ":" + "`"$($Filter[$Key])`"" + ","
5353
}
5454
$FilterString = $FilterString.trimend(',')

Private/Format-LMFilter.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Function Format-LMFilter {
5252
If ($Filter -match '\s+-and\s+') {
5353
$FormatedFilter += ","
5454
}
55-
ElseIf ($Filter -match '\s+-or\s+') {
55+
Elseif ($Filter -match '\s+-or\s+') {
5656
$FormatedFilter += "||"
5757
}
5858
Else {

Private/New-LMHeader.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ Function New-LMHeader {
6666
$Token = [System.Net.NetworkCredential]::new("", $Auth.BearerToken).Password
6767
$Header.Add("Authorization", "Bearer $Token")
6868
}
69-
ElseIf ($Auth.Type -eq "SessionSync") {
69+
Elseif ($Auth.Type -eq "SessionSync") {
7070
$SessionInfo = Get-LMSession -AccountName $Auth.Portal
7171
If ($SessionInfo) {
7272
$Header.Add("Cookie", "JSESSIONID=$($SessionInfo.jSessionID)")
7373
$Session.Cookies.Add((New-Object System.Net.Cookie("JSESSIONID", $SessionInfo.jSessionID, "/", $SessionInfo.domain)))
7474
$Header.Add("X-CSRF-Token", "$($SessionInfo.token)")
7575
}
7676
Else {
77-
throw "Unable to generate header details, ensure you are connected to a portal and try again."
77+
Throw "Unable to generate header details, ensure you are connected to a portal and try again."
7878
}
7979
}
8080
Else {

Private/Resolve-LMDebugInfo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ Function Resolve-LMDebugInfo {
3434
Write-Debug "Bound Parameters: $($Command.BoundParameters.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $($_.Value) + "]"})"
3535
Write-Debug "Invoked URL: $Url"
3636
If ($Payload) { Write-Debug "Request Payload: `n$Payload" }
37-
Write-Debug "Request Headers: $($Headers.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $(if ($_.Value.length -gt 25) { $_.Value.substring(0, 25) + "...]" } else { $($_.Value) + "]" })})"
37+
Write-Debug "Request Headers: $($Headers.GetEnumerator() | ForEach-Object {"[" + $($_.Key) + ":" + $(If ($_.Value.length -gt 25) { $_.Value.substring(0, 25) + "...]" } Else { $($_.Value) + "]" })})"
3838
}

Private/Resolve-LMException.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Function Resolve-LMException {
4848
[Console]::ForegroundColor = 'red'
4949
[Console]::Error.WriteLine("Failed to execute web request($($HttpStatusCode)): $HttpException")
5050
[Console]::ResetColor()
51-
#throw "Failed to execute web request($($HttpStatusCode)): $HttpException"
5251
}
5352
}
5453
default {
@@ -62,7 +61,6 @@ Function Resolve-LMException {
6261
[Console]::ForegroundColor = 'red'
6362
[Console]::Error.WriteLine("Failed to execute web request: $LMError")
6463
[Console]::ResetColor()
65-
#throw "Failed to execute web request: $LMError"
6664
}
6765
}
6866
}

Private/Test-LookupResult.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Function Test-LookupResult {
2929
return $true
3030
}
3131
#If empty stop processing since we have no Id to use
32-
ElseIf (!$Result) {
32+
Elseif (!$Result) {
3333
[Console]::ForegroundColor = 'red'
3434
[Console]::Error.WriteLine("Unable to find resource for the specified name value: $LookupString. Please check spelling and try again.")
3535
[Console]::ResetColor()

Private/Update-LogicMonitorModule.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Function Update-LogicMonitorModule {
4646
If ($Installed -is [Array]) {
4747
$InstalledVersion = $Installed[0].Version
4848
}
49-
ElseIf ($Installed.Version) {
49+
Elseif ($Installed.Version) {
5050
$InstalledVersion = $Installed.Version
5151
}
5252
Else {
@@ -65,7 +65,7 @@ Function Update-LogicMonitorModule {
6565
If ($CheckOnly) {
6666
Write-LMHost "[INFO]: You are currently using an outdated version ($InstalledVersion) of $Module, please consider upgrading to the latest version ($OnlineVersion) as soon as possible. Use the -AutoUpdateModule switch next time you connect to auto upgrade to the latest version." -ForegroundColor Yellow
6767
}
68-
ElseIf ($UninstallFirst -eq $true) {
68+
Elseif ($UninstallFirst -eq $true) {
6969
Write-LMHost "[INFO]: You are currently using an outdated version ($InstalledVersion) of $Module, uninstalling prior Module $Module version $InstalledVersion" -ForegroundColor Yellow
7070
Uninstall-Module -Name $Module -Force -Verbose:$False
7171

0 commit comments

Comments
 (0)