forked from dfinke/ImportExcel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGet-ModuleStats.ps1
More file actions
21 lines (18 loc) · 983 Bytes
/
Copy pathGet-ModuleStats.ps1
File metadata and controls
21 lines (18 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<#
.Synopsis
Chart download stats for modules/scripts published on the PowerShell Gallery
.Example
.\Get-ModuleStats.ps1 ImportExcel
#>
param(
$moduleName = "ImportExcel",
[ValidateSet('Column','Bar','Line','Pie')]
$chartType="Line"
)
$download = Get-HtmlTable "https://www.powershellgallery.com/packages/$moduleName" -FirstDataRow 1 |
Select-Object @{n="Version";e={$v = $Null ; if ($_.version -is [valuetype]) {[string][version]($_.version.tostring("0.0")) }
elseif ($_.version -is [string] -and [version]::TryParse($_.version.trim(),[ref]$v)) {$v}
else {$_.Version.trim() -replace "\s+"," " } }},
Downloads, @{n="LastUpdated";e={[datetime]$_.last_updated}} |
Sort-Object lastupdated -Descending
& "$($chartType)Chart" $download "Download stats for $moduleName" -nolegend:($chartype -ne 'pie')