diff --git a/Examples/ScriptAnalyzer/Analyze_this.ps1 b/Examples/ScriptAnalyzer/Analyze_this.ps1 index c88d67f..77aad5d 100644 --- a/Examples/ScriptAnalyzer/Analyze_this.ps1 +++ b/Examples/ScriptAnalyzer/Analyze_this.ps1 @@ -1,13 +1,25 @@ <# .Synopsis + Runs PsScriptAnalyzer against one or more folders and pivots the results to form a report. + .Example + Analyze_this.ps1 + Invokes script analyzer on the current directory; creates a file in $env:temp and opens it in Excel + .Example + Analyze_this.ps1 -xlfile ..\mymodule.xlsx -quiet + Invokes script analyzer on the current directory; creates a file in the parent directory but does not open it + .Example + "." , (dir 'C:\Program Files\WindowsPowerShell\Modules\ImportExcel\') | .\examples\ScriptAnalyzer\Analyze_this.ps1 + run from a developemnt directory for importExcel it will produce a report for that directory compared against installed versions + this creates the file in the default location and opens it #> [CmdletBinding()] param ( [parameter(ValueFromPipeline = $true)] - $Path = $PWD, - $xlfile = "$env:TEMP\ScriptAnalyzer.xlsx", - $ChartType = 'BarClustered' , + $Path = $PWD, + $xlfile = "$env:TEMP\ScriptAnalyzer.xlsx", + $ChartType = 'BarClustered' , + $PivotColumns = 'Location', [switch]$Quiet ) @@ -37,7 +49,7 @@ process { } end { - $pivotParams['-PivotChartDefinition'] = New-ExcelChartDefinition -ChartType $chartType -Column $dirsToProcess.Count -Title "Script analysis" -LegendBold + $pivotParams['-PivotChartDefinition'] = New-ExcelChartDefinition -ChartType $chartType -Column (1 + $dirsToProcess.Count) -Title "Script analysis" -LegendBold $xlparams['PivotTableDefinition'] = New-PivotTableDefinition @pivotParams $dirsToProcess | ForEach-Object {