From 83813598b4baf9a1036a44e5c572cac616c91fc5 Mon Sep 17 00:00:00 2001 From: Kirk Munro Date: Fri, 4 Oct 2019 13:58:37 -0300 Subject: [PATCH 1/4] add -ia alias for -informationaction --- .../engine/CommonCommandParameters.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/CommonCommandParameters.cs b/src/System.Management.Automation/engine/CommonCommandParameters.cs index e049fb52f2c..90f3d093ad8 100644 --- a/src/System.Management.Automation/engine/CommonCommandParameters.cs +++ b/src/System.Management.Automation/engine/CommonCommandParameters.cs @@ -109,7 +109,7 @@ public ActionPreference WarningAction /// This parameter tells the command what to do when an informational record occurs. /// [Parameter] - [Alias("infa")] + [Alias("infa", "ia")] public ActionPreference InformationAction { get { return _commandRuntime.InformationPreference; } From 26089d8f0c6b1a6a7c60092bc3913fdaf6d8fc2a Mon Sep 17 00:00:00 2001 From: Kirk Munro Date: Fri, 4 Oct 2019 14:20:51 -0300 Subject: [PATCH 2/4] add Pester test --- .../Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 index 19c23d90e6f..922345ea9c5 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 @@ -122,4 +122,11 @@ Describe "Stream writer tests" -Tags "CI" { $i.MessageData | Should -Be $null } } + + Context "Stream common parameter tests" { + It '-InformationAction accepts -ia alias' { + Write-Information -MessageData Test -ia Continue -iv i *> $null + $i.MessageData | Should -BeExactly 'Test' + } + } } From ffe25b073c0c3370f5593b35ded73555d7101974 Mon Sep 17 00:00:00 2001 From: Kirk Munro Date: Wed, 9 Oct 2019 21:17:05 -0300 Subject: [PATCH 3/4] remove ia alias, add comment explanation --- .../engine/CommonCommandParameters.cs | 6 +++++- .../Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 | 7 ------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/System.Management.Automation/engine/CommonCommandParameters.cs b/src/System.Management.Automation/engine/CommonCommandParameters.cs index 90f3d093ad8..b01e1288c0b 100644 --- a/src/System.Management.Automation/engine/CommonCommandParameters.cs +++ b/src/System.Management.Automation/engine/CommonCommandParameters.cs @@ -109,7 +109,11 @@ public ActionPreference WarningAction /// This parameter tells the command what to do when an informational record occurs. /// [Parameter] - [Alias("infa", "ia")] + [Alias("infa")] + // NOTE: The "infa" alias name does not follow the same alias naming convention used + // with other common parameter aliases that control stream functionality; however, + // "ia" was already taken as a parameter alias in other commands when this parameter + // was added to PowerShell, so "infa" was chosen instead. public ActionPreference InformationAction { get { return _commandRuntime.InformationPreference; } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 index 922345ea9c5..19c23d90e6f 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Write-Stream.Tests.ps1 @@ -122,11 +122,4 @@ Describe "Stream writer tests" -Tags "CI" { $i.MessageData | Should -Be $null } } - - Context "Stream common parameter tests" { - It '-InformationAction accepts -ia alias' { - Write-Information -MessageData Test -ia Continue -iv i *> $null - $i.MessageData | Should -BeExactly 'Test' - } - } } From a5f541eedb8d0b71276e5f11b52e21564b56eced Mon Sep 17 00:00:00 2001 From: Kirk Munro Date: Wed, 9 Oct 2019 21:23:21 -0300 Subject: [PATCH 4/4] update comment positioning --- .../engine/CommonCommandParameters.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/System.Management.Automation/engine/CommonCommandParameters.cs b/src/System.Management.Automation/engine/CommonCommandParameters.cs index b01e1288c0b..4ae05ac878b 100644 --- a/src/System.Management.Automation/engine/CommonCommandParameters.cs +++ b/src/System.Management.Automation/engine/CommonCommandParameters.cs @@ -108,12 +108,14 @@ public ActionPreference WarningAction /// /// This parameter tells the command what to do when an informational record occurs. /// + /// [Parameter] [Alias("infa")] - // NOTE: The "infa" alias name does not follow the same alias naming convention used - // with other common parameter aliases that control stream functionality; however, - // "ia" was already taken as a parameter alias in other commands when this parameter - // was added to PowerShell, so "infa" was chosen instead. public ActionPreference InformationAction { get { return _commandRuntime.InformationPreference; }