From 3aa8df2cefb7c23bc31e2665fe3ae589c0a5f5a1 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 24 Jun 2021 10:15:46 +0200 Subject: [PATCH] Add list-tiobe-index.ps1 --- Data/TIOBE-index.csv | 21 ++++++++++++++++ Data/scripts.csv | 1 + README.md | 1 + Scripts/list-tiobe-index.ps1 | 47 ++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 Data/TIOBE-index.csv create mode 100644 Scripts/list-tiobe-index.ps1 diff --git a/Data/TIOBE-index.csv b/Data/TIOBE-index.csv new file mode 100644 index 00000000..4c9cc559 --- /dev/null +++ b/Data/TIOBE-index.csv @@ -0,0 +1,21 @@ +Language, Popularity, Change +C, 12.54, -4.65% +Python, 11.84, +3.48% +Java, 11.54, -4.56% +C++, 7.36, +1.41% +C#, 4.33, -0.40% +Visual Basic, 4.01, -0.68% +JavaScript, 2.33, +0.06% +PHP, 2.21, -0.05% +Assembly language, 2.05, +1.09% +SQL, 1.88, +0.15% +Classic Visual Basic, 1.72, +1.07% +Groovy, 1.29, +0.87% +Ruby, 1.23, +0.25% +R, 1.20, -0.99% +Perl, 1.18, +0.36% +Swift, 1.10, -0.35% +Fortran, 1.07, +0.80% +Delphi/Object Pascal, 1.06, +0.47% +MATLAB, 1.05, +0.15% +Go, 0.95, -0.06% diff --git a/Data/scripts.csv b/Data/scripts.csv index 039d84fb..3a224857 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -123,6 +123,7 @@ list-tags.ps1, lists all tags in the current/given Git repository list-tasks.ps1, lists all Windows scheduler tasks list-timezone.ps1, lists the current time zone details list-timezones.ps1, lists all time zones available +list-tiobe-index.ps1, lists the TIOBE index of top programming languages list-user-groups.ps1, lists the user groups on the local computer list-weather.ps1, lists the hourly weather list-workdir.ps1, lists the current working directory diff --git a/README.md b/README.md index 3509bec0..011583d3 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,7 @@ Mega Collection of PowerShell Scripts * [list-random-passwords.ps1](Scripts/list-random-passwords.ps1) - prints a list of random passwords * [list-random-pins.ps1](Scripts/list-random-pins.ps1) - prints a list of random PIN's * [list-sql-tables.ps1](Scripts/list-sql-tables.ps1) - lists the SQL server tables +* [list-tiobe-index.ps1](Scripts/list-tiobe-index.ps1) - lists the TIOBE index of top programming languages * [list-weather.ps1](Scripts/list-weather.ps1) - lists the hourly weather * [locate-city.ps1](Scripts/locate-city.ps1) - prints the geographic location of the given city * [locate-ipaddress.ps1](Scripts/locate-ipaddress.ps1) - prints the geographic location of the given IP address diff --git a/Scripts/list-tiobe-index.ps1 b/Scripts/list-tiobe-index.ps1 new file mode 100644 index 00000000..5181d9b6 --- /dev/null +++ b/Scripts/list-tiobe-index.ps1 @@ -0,0 +1,47 @@ +<# +.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 +#> + +function WriteBar { param([string]$Text, [float]$Value, [float]$Max, [string]$Hint) + $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 "▏" + } + " $Text $($Value)% ($Hint)" +} + +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 + [string]$Hint = $Row.Change + WriteBar $Name $Value 14.0 $Hint + } + exit 0 +} catch { + write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}