Updated list-tiobe-index.ps1

This commit is contained in:
Markus Fleschutz
2025-08-07 15:58:39 +02:00
parent d20acb7171
commit a704645a27

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists the TIOBE index of top programming languages Lists the TIOBE index
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the TIOBE index of top programming languages. This PowerShell script lists the TIOBE index of top programming languages.
.EXAMPLE .EXAMPLE
@ -11,49 +11,50 @@
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
function WriteBar { param([string]$Text, [float]$Value, [float]$Max, [float]$Change) function WriteBar { param([string]$text, [float]$value, [float]$max, [float]$change)
$Num = ($Value * 100.0) / $Max $num = ($value * 100.0) / $max
while ($Num -ge 1.0) { while ($num -ge 1.0) {
write-host -noNewLine "" Write-Host "" -noNewline
$Num -= 1.0 $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 -noNewLine " $Text $($Value)%" Write-Host " $text $($value)%" -noNewline
if ($Change -ge 0.0) { if ($change -ge 0.0) {
write-host -foregroundColor green " +$($Change)%" Write-Host -foregroundColor green " +$($change)%"
} else { } else {
write-host -foregroundColor red " $($Change)%" Write-Host -foregroundColor red " $($change)%"
} }
} }
try { try {
& write-big.ps1 "TIOBE INDEX 2021-06" Write-Host ""
" Source: https://www.tiobe.com" Write-Host "TIOBE INDEX 2021-06 (source: https://www.tiobe.com)"
"" Write-Host "===================================================="
Write-Host ""
$Table = import-csv "$PSScriptRoot/../data/TIOBE-index.csv" $table = Import-CSV "$PSScriptRoot/../data/TIOBE-index.csv"
foreach($Row in $Table) { foreach($row in $table) {
[string]$Name = $Row.Language [string]$name = $row.Language
[float]$Value = $Row.Popularity [float]$value = $row.Popularity
[float]$Change = $Row.Change [float]$change = $row.Change
WriteBar $Name $Value 14.0 $Change WriteBar $name $value 14.0 $change
} }
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1 exit 1
} }