PowerShell/scripts/list-tiobe-index.ps1

60 lines
1.5 KiB
PowerShell
Raw Normal View History

2023-10-31 12:33:36 +01:00
<#
2021-07-13 21:10:02 +02:00
.SYNOPSIS
2021-09-24 17:19:49 +02:00
Lists the TIOBE index of top programming languages
2021-10-04 21:29:23 +02:00
.DESCRIPTION
2022-01-29 12:47:46 +01:00
This PowerShell script lists the TIOBE index of top programming languages.
2021-07-13 21:10:02 +02:00
.EXAMPLE
2023-08-06 21:35:36 +02:00
PS> ./list-tiobe-index.ps1
2021-07-13 21:10:02 +02:00
.LINK
https://github.com/fleschutz/PowerShell
2022-01-29 12:47:46 +01:00
.NOTES
2022-09-06 21:42:04 +02:00
Author: Markus Fleschutz | License: CC0
2021-06-24 10:15:46 +02:00
#>
2021-06-25 09:15:26 +02:00
function WriteBar { param([string]$Text, [float]$Value, [float]$Max, [float]$Change)
2021-06-27 11:40:47 +02:00
$Num = ($Value * 100.0) / $Max
2021-06-24 10:15:46 +02:00
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-27 11:40:47 +02:00
write-host -noNewLine " $Text $($Value)%"
2021-06-25 09:15:26 +02:00
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"
2021-06-27 11:40:47 +02:00
" Source: https://www.tiobe.com"
2021-06-24 10:15:46 +02:00
""
2023-10-31 11:25:11 +01:00
$Table = import-csv "$PSScriptRoot/../data/TIOBE-index.csv"
2021-06-24 10:15:46 +02:00
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
}
2021-09-27 10:09:45 +02:00
exit 0 # success
2021-06-24 10:15:46 +02:00
} catch {
2022-04-13 12:06:32 +02:00
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
2021-06-24 10:15:46 +02:00
exit 1
}