File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
src/PowerShellEditorServices/Analysis Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ public AnalysisService(string settingsPath, ILogger logger)
129129 this . analysisRunspacePool . Open ( ) ;
130130
131131 ActiveRules = IncludedRules . ToArray ( ) ;
132+ EnumeratePSScriptAnalyzerCmdlets ( ) ;
132133 EnumeratePSScriptAnalyzerRules ( ) ;
133134 }
134135 catch ( Exception e )
@@ -346,6 +347,29 @@ private static PSModuleInfo FindPSScriptAnalyzerModule(ILogger logger)
346347 }
347348 }
348349
350+ private void EnumeratePSScriptAnalyzerCmdlets ( )
351+ {
352+ if ( hasScriptAnalyzerModule )
353+ {
354+ var sb = new StringBuilder ( ) ;
355+ var commands = InvokePowerShell (
356+ "Get-Command" ,
357+ new Dictionary < string , object >
358+ {
359+ { "Module" , "PSScriptAnalyzer" }
360+ } ) ;
361+
362+ var commandNames = commands ?
363+ . Select ( c => c . ImmediateBaseObject as CmdletInfo )
364+ . Where ( c => c != null )
365+ . Select ( c => c . Name ) ?? Enumerable . Empty < string > ( ) ;
366+
367+ sb . AppendLine ( "The following cmdlets are available in the imported PSScriptAnalyzer module:" ) ;
368+ sb . AppendLine ( String . Join ( Environment . NewLine , commandNames . Select ( s => " " + s ) ) ) ;
369+ this . logger . Write ( LogLevel . Verbose , sb . ToString ( ) ) ;
370+ }
371+ }
372+
349373 private void EnumeratePSScriptAnalyzerRules ( )
350374 {
351375 if ( hasScriptAnalyzerModule )
You can’t perform that action at this time.
0 commit comments