PowerShell/Scripts/list-tiobe-index.ps1

53 lines
1.4 KiB
PowerShell
Raw Normal View History

2021-06-24 10:18:43 +02:00
<#
2021-06-24 10:15:46 +02:00
.SYNTAX list-tiobe-index.ps1
.DESCRIPTION lists the TIOBE index of top programming languages
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
2021-06-25 09:15:26 +02:00
function WriteBar { param([string]$Text, [float]$Value, [float]$Max, [float]$Change)
2021-06-24 10:15:46 +02:00
$Num = ($Value * 70.0) / $Max
while ($Num -ge 1.0) {
write-host -noNewLine ""
$Num -= 1.0
}
if ($Num -ge 0.875) {
write-host -noNewLine ""
} elseif ($Num -ge 0.75) {
write-host -noNewLine ""
} elseif ($Num -ge 0.625) {
write-host -noNewLine ""
} elseif ($Num -ge 0.5) {
write-host -noNewLine ""
} elseif ($Num -ge 0.375) {
write-host -noNewLine ""
} elseif ($Num -ge 0.25) {
write-host -noNewLine ""
} elseif ($Num -ge 0.125) {
write-host -noNewLine ""
}
2021-06-25 09:15:26 +02:00
write-host -noNewLine " $Text $($Value)%"
if ($Change -ge 0.0) {
write-host -foregroundColor green " +$($Change)%"
} else {
write-host -foregroundColor red " $($Change)%"
}
2021-06-24 10:15:46 +02:00
}
try {
& write-big.ps1 "TIOBE INDEX 2021-06"
""
$Table = import-csv "$PSScriptRoot/../Data/TIOBE-index.csv"
foreach($Row in $Table) {
[string]$Name = $Row.Language
[float]$Value = $Row.Popularity
2021-06-25 09:15:26 +02:00
[float]$Change = $Row.Change
WriteBar $Name $Value 14.0 $Change
2021-06-24 10:15:46 +02:00
}
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}