Adding next Palace game to your PowerShell profile

vendredi 17 mars 2017

I know this will be of limited appeal, but I found a football api on the web last night so was able to add a few lines to my PowerShell profile to show the next Palace game every time I start PS.



Here are the lines to add:
Code:

try
{
    $response = Invoke-RestMethod -Uri http://ift.tt/2ngEQ4j -ErrorAction Stop
    $nextmatch = $response.fixtures |
    Where-Object -FilterScript {
        $_.status -eq 'TIMED'
    } |
    Select-Object -Property homeTeamName, awayTeamName, date -First 1
    "The next Palace match is on $(Get-Date -Date ($nextmatch.date) -Format 'dddd, MMMM %d yyyy HH:mm') - $($nextmatch.homeTeamName -replace(' FC','')) v $($nextmatch.awayTeamName -replace(' FC',''))"
}
catch
{
    'No Palace fixtures available.'
}



0 commentaires:

Enregistrer un commentaire