Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2020
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. param (
  2.         [string]$Country = 'finland'
  3.     )
  4.  
  5. $headers=@{
  6.     'x-rapidapi-host' = 'coronavirus-monitor.p.rapidapi.com'
  7.     'x-rapidapi-key'  = '<KEY HERE>'
  8. }
  9. $Restparam = @{
  10.     'uri' = "https://coronavirus-monitor.p.rapidapi.com/coronavirus/latest_stat_by_country.php?country=$Country"
  11.     Method = 'Get'
  12.     Headers = $Headers
  13. }
  14. $response = Invoke-RestMethod @restparam
  15. $recorddate = Get-Date $response.latest_stat_by_country.record_date
  16. Write-Host "COV-ID-19 Stats for $Country from $recordDate" -ForegroundColor Red
  17. write-host "Active:$($response.latest_stat_by_country.active_cases)" -ForegroundColor Magenta -NoNewline
  18. write-host "($($response.latest_stat_by_country.new_cases))  " -ForegroundColor Magenta -NoNewline
  19. write-host "Fatal:$($response.latest_stat_by_country.total_deaths)" -ForegroundColor DarkGray -NoNewline
  20. write-host "($($response.latest_stat_by_country.new_deaths))  " -ForegroundColor DarkGray -NoNewline
  21. write-host "Recovered:$($response.latest_stat_by_country.total_recovered)" -ForegroundColor Green
  22.  
  23.  
  24. function prompt
  25. {
  26.     $m = 30 # maximum prompt length
  27.     $str = $pwd.Path
  28.     if ($str.length -ge $m)
  29.     {
  30.         # The prompt will begin with "...",
  31.         # end with ">", and in between contain
  32.         # as many of the path characters as will fit,
  33.         # reading from the end of the path.
  34.         $str = "..." + $str.substring($str.length - $m + 4)
  35.     }
  36.     "C-"+"$str> "
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement