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:
Asif Bacchus 2021-09-05 23:53:33 -06:00
parent 043bca95a2
commit 5003661a63

View File

@ -32,8 +32,14 @@ function exitError($errMessage, $PSItem, $exitCode = 1)
Exit $exitCode
}
$wolModuleName = "wol-magicPacket"
$wolDatabase = "WOLDatabase.xml"
function exitGracefully()
{
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
if (!(Get-Module -Name $wolModuleName))