mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-15 19:21:04 +01:00
Update list-coffee-prices.ps1
This commit is contained in:
parent
1bb23f8dda
commit
1349be0b49
@ -2,9 +2,9 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
List coffee prices
|
List coffee prices
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script queries cryptocompare.com and lists the current crypto exchange rates in USD/EUR/RUB/CNY.
|
This PowerShell script queries alphavantage.co and lists the global price of coffee (monthly, in cents per points).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./list-crypto-rates
|
PS> ./list-coffee-prices
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -14,24 +14,21 @@
|
|||||||
function WriteBar { param([string]$Text, [float]$Value, [float]$Max)
|
function WriteBar { param([string]$Text, [float]$Value, [float]$Max)
|
||||||
Write-Host "$Text " -noNewline
|
Write-Host "$Text " -noNewline
|
||||||
$Num = ($Value * 100.0) / $Max
|
$Num = ($Value * 100.0) / $Max
|
||||||
while ($Num -ge 1.0) {
|
while ($Num -ge 1.0) { Write-Host "█" -noNewline; $Num -= 1.0 }
|
||||||
write-host -noNewLine "█"
|
|
||||||
$Num -= 1.0
|
|
||||||
}
|
|
||||||
if ($Num -ge 0.875) {
|
if ($Num -ge 0.875) {
|
||||||
write-host -noNewLine "▉"
|
Write-Host -noNewLine "▉"
|
||||||
} elseif ($Num -ge 0.75) {
|
} elseif ($Num -ge 0.75) {
|
||||||
write-host -noNewLine "▊"
|
Write-Host -noNewLine "▊"
|
||||||
} elseif ($Num -ge 0.625) {
|
} elseif ($Num -ge 0.625) {
|
||||||
write-host -noNewLine "▋"
|
Write-Host -noNewLine "▋"
|
||||||
} elseif ($Num -ge 0.5) {
|
} elseif ($Num -ge 0.5) {
|
||||||
write-host -noNewLine "▌"
|
Write-Host -noNewLine "▌"
|
||||||
} elseif ($Num -ge 0.375) {
|
} elseif ($Num -ge 0.375) {
|
||||||
write-host -noNewLine "▍"
|
Write-Host -noNewLine "▍"
|
||||||
} elseif ($Num -ge 0.25) {
|
} elseif ($Num -ge 0.25) {
|
||||||
write-host -noNewLine "▎"
|
Write-Host -noNewLine "▎"
|
||||||
} elseif ($Num -ge 0.125) {
|
} elseif ($Num -ge 0.125) {
|
||||||
write-host -noNewLine "▏"
|
Write-Host -noNewLine "▏"
|
||||||
}
|
}
|
||||||
Write-Host " $Value"
|
Write-Host " $Value"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user