You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Home-AssistantConfig/tools/holiday_lighting_coverage.ps1

33 lines
678 B

param(
[int]$Months = 24,
[datetime]$StartDate = (Get-Date).Date
)
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$repoRoot = Split-Path -Parent $PSScriptRoot
$python = Get-Command py -ErrorAction SilentlyContinue
$arguments = @()
if ($python) {
$arguments += '-3'
} else {
$python = Get-Command python -ErrorAction SilentlyContinue
}
if (-not $python) {
throw "Python 3 not found. Install Python 3 and the pinned requirements in requirements-dev.txt."
}
$arguments += @(
"$repoRoot/tools/holiday_lighting_coverage.py"
'--months'
$Months
'--start-date'
$StartDate.ToString('yyyy-MM-dd')
)
& $python.Source @arguments
exit $LASTEXITCODE

Powered by TurnKey Linux.