Skip to content

Commit 64bda70

Browse files
author
Kapil Borle
committed
Merge pull request #526 from PowerShell/RuleNameAsPositionalParam
Add Name as a positional parameter for Get-ScriptAnalyzerRule
2 parents f0bd654 + 43c6c69 commit 64bda70

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Engine/Commands/GetScriptAnalyzerRuleCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public SwitchParameter RecurseCustomRulePath
5656
/// <summary>
5757
/// Name: The name of a specific rule to list.
5858
/// </summary>
59-
[Parameter(Mandatory = false)]
59+
[Parameter(Mandatory = false, Position = 1)]
6060
[ValidateNotNullOrEmpty]
6161
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
6262
public string[] Name

Tests/Engine/GetScriptAnalyzerRule.tests.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,15 @@ Describe "Test Name parameters" {
5454
($rules | Where-Object {$_.RuleName -eq $approvedVerbs}).Count | Should Be 1
5555
}
5656

57-
It "Get Rules with no parameters supplied" {
57+
It "get Rules with no parameters supplied" {
5858
$defaultRules = Get-ScriptAnalyzerRule
5959
$defaultRules.Count | Should be 41
6060
}
61+
62+
It "is a positional parameter" {
63+
$rules = Get-ScriptAnalyzerRule *alias*
64+
$rules.Count | Should Be 1
65+
}
6166
}
6267

6368
Context "When used incorrectly" {

0 commit comments

Comments
 (0)