Skip to content

Commit

Permalink
Add a script to count generated cmdlets (Azure#15987)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolauli authored Oct 8, 2021
1 parent 677909f commit c80ec9a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tools/cmdletcount.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Usage
# ./cmdletcount.ps1 -path ../src/

param([string]$path = './')

$moduleList = @('ADDomainServices', 'Aks/Aks.Autorest', 'AppConfiguration','Blockchain','BotService','ChangeAnalysis','CloudService','Communication','Confluent','ConnectedKubernetes','ConnectedMachine','ContainerInstance','CostManagement','CustomProviders', 'DataBox', 'Databricks','Datadog','DataProtection','DedicatedHsm','DesktopVirtualization','DigitalTwins','DiskPool','DnsResolver','Elastic','Functions','HanaOnAzure','HealthBot','ImageBuilder','ImportExport','KubernetesConfiguration','Kusto','Maps','MariaDb','Migrate','MonitoringSolutions','MySql','Portal','PostgreSql','ProviderHub','Purview','RedisEnterpriseCache','ResourceGraph/ResourceGraph.Autorest','ResourceMover','SpringCloud','StreamAnalytics','Synapse/Synapse.Autorest','TimeSeriesInsights','VMware','Websites/Websites.Autorest','WindowsIotServices')

$resultFile = './result.csv'

$result = @()

foreach ($module in $moduleList) {
$modulePath = Join-Path (Join-Path $path $module) docs
$customPath = Join-Path (Join-Path $path $module) custom
$module = $module.Split('/')[0]
$cmdlets = Get-ChildItem $modulePath -Exclude readme.md, "Az.$module.md", "$module.md" | foreach {$_.name.Split(".")[0]}
foreach ($cmdlet in $cmdlets) {
$isCustom = Get-ChildItem $customPath -Include "$cmdlet.ps1" -Recurse
$genMode = "Autogen"
if ($isCustom) {
$genMode = "Custom"
}
$item = @{Module = "Az.$module"; Cmdlet = "$cmdlet"; GenMode = "$genMode"}
$result += [pscustomobject]$item
}
}

$result | ConvertTo-Csv | Out-File -Path $resultFile

0 comments on commit c80ec9a

Please sign in to comment.