Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- param (
- [string]$Country = 'finland'
- )
- $headers=@{
- 'x-rapidapi-host' = 'coronavirus-monitor.p.rapidapi.com'
- 'x-rapidapi-key' = '<KEY HERE>'
- }
- $Restparam = @{
- 'uri' = "https://coronavirus-monitor.p.rapidapi.com/coronavirus/latest_stat_by_country.php?country=$Country"
- Method = 'Get'
- Headers = $Headers
- }
- $response = Invoke-RestMethod @restparam
- $recorddate = Get-Date $response.latest_stat_by_country.record_date
- Write-Host "COV-ID-19 Stats for $Country from $recordDate" -ForegroundColor Red
- write-host "Active:$($response.latest_stat_by_country.active_cases)" -ForegroundColor Magenta -NoNewline
- write-host "($($response.latest_stat_by_country.new_cases)) " -ForegroundColor Magenta -NoNewline
- write-host "Fatal:$($response.latest_stat_by_country.total_deaths)" -ForegroundColor DarkGray -NoNewline
- write-host "($($response.latest_stat_by_country.new_deaths)) " -ForegroundColor DarkGray -NoNewline
- write-host "Recovered:$($response.latest_stat_by_country.total_recovered)" -ForegroundColor Green
- function prompt
- {
- $m = 30 # maximum prompt length
- $str = $pwd.Path
- if ($str.length -ge $m)
- {
- # The prompt will begin with "...",
- # end with ">", and in between contain
- # as many of the path characters as will fit,
- # reading from the end of the path.
- $str = "..." + $str.substring($str.length - $m + 4)
- }
- "C-"+"$str> "
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement