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