refactor(wakeup): move exit to function, use constants
- move graceful exit to function to DRY code - use constant for wol module name
This commit is contained in:
parent
043bca95a2
commit
5003661a63
10
wakeup.ps1
10
wakeup.ps1
@ -32,8 +32,14 @@ function exitError($errMessage, $PSItem, $exitCode = 1)
|
|||||||
Exit $exitCode
|
Exit $exitCode
|
||||||
}
|
}
|
||||||
|
|
||||||
$wolModuleName = "wol-magicPacket"
|
function exitGracefully()
|
||||||
$wolDatabase = "WOLDatabase.xml"
|
{
|
||||||
|
Write-Host -ForegroundColor Green "`r`nFinished.`r`n"
|
||||||
|
Exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# constants
|
||||||
|
Set-Variable -Name wolModuleName -Value "wol-magicPacket" -Option Constant
|
||||||
|
|
||||||
# exit on error if Send-MagicPacket module is not loaded
|
# exit on error if Send-MagicPacket module is not loaded
|
||||||
if (!(Get-Module -Name $wolModuleName))
|
if (!(Get-Module -Name $wolModuleName))
|
||||||
|
Loading…
Reference in New Issue
Block a user