From 2f9a0143bd1e4c1b2ab339ba3e3bb25a6e81f1fa Mon Sep 17 00:00:00 2001 From: Michael Lombardi Date: Wed, 10 Jul 2024 11:37:26 -0500 Subject: [PATCH] (GH-11248) Clarify behavior for `Register-ArgumentCompleter` parameters Prior to this change, the `Register-ArgumentCompleter` reference didn't indicate that specifying the **CommandName** parameter without the **ParameterName** or **Native** parameters causes the command to behave as if the user specified the `-Native` switch. This change: - Clarifies that users should always specify the **ParameterName** parameter when registering an argument completer for a PowerShell command. - Resolves #11248 - Fixes AB#281953 --- .../Register-ArgumentCompleter.md | 12 +++++++++++- .../Register-ArgumentCompleter.md | 12 +++++++++++- .../Register-ArgumentCompleter.md | 12 +++++++++++- .../Register-ArgumentCompleter.md | 12 +++++++++++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/reference/5.1/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md b/reference/5.1/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md index 6b3f21bf081b..0681a2ee58e6 100644 --- a/reference/5.1/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md +++ b/reference/5.1/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 07/10/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/register-argumentcompleter?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 title: Register-ArgumentCompleter @@ -36,6 +36,12 @@ The `Register-ArgumentCompleter` cmdlet registers a custom argument completer. A completer allows you to provide dynamic tab completion, at run time for any command that you specify. +When you call this command with the **CommandName** parameter and without the **ParameterName** or +**Native** parameters, the command runs as if you specified the **Native** parameter. This prevents +the argument completer from working for PowerShell command parameters. Always specify the +**ParameterName** parameter when you want to register an argument completer for a PowerShell +command. + ## EXAMPLES ### Example 1: Register a custom argument completer @@ -182,6 +188,10 @@ cannot be an enumerated value, such as the **ForegroundColor** parameter of the For more information on enums, see [about_Enum](./About/about_Enum.md). +When registering an argument completer for a specific PowerShell command, always specify this +parameter. When you specify the **CommandName** parameter without the **ParameterName** or +**Native** parameters, the command behaves as if you specified the **Native** parameter. + ```yaml Type: System.String Parameter Sets: PowerShellSet diff --git a/reference/7.2/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md b/reference/7.2/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md index d800c97323b7..d56a1ad8d006 100644 --- a/reference/7.2/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md +++ b/reference/7.2/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 07/10/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/register-argumentcompleter?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 title: Register-ArgumentCompleter @@ -36,6 +36,12 @@ The `Register-ArgumentCompleter` cmdlet registers a custom argument completer. A completer allows you to provide dynamic tab completion, at run time for any command that you specify. +When you call this command with the **CommandName** parameter and without the **ParameterName** or +**Native** parameters, the command runs as if you specified the **Native** parameter. This prevents +the argument completer from working for PowerShell command parameters. Always specify the +**ParameterName** parameter when you want to register an argument completer for a PowerShell +command. + ## EXAMPLES ### Example 1: Register a custom argument completer @@ -182,6 +188,10 @@ cannot be an enumerated value, such as the **ForegroundColor** parameter of the For more information on enums, see [about_Enum](./About/about_Enum.md). +When registering an argument completer for a specific PowerShell command, always specify this +parameter. When you specify the **CommandName** parameter without the **ParameterName** or +**Native** parameters, the command behaves as if you specified the **Native** parameter. + ```yaml Type: System.String Parameter Sets: PowerShellSet diff --git a/reference/7.4/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md b/reference/7.4/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md index d0597195746b..9d82ba01d96b 100644 --- a/reference/7.4/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md +++ b/reference/7.4/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 07/10/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/register-argumentcompleter?view=powershell-7.4&WT.mc_id=ps-gethelp schema: 2.0.0 title: Register-ArgumentCompleter @@ -36,6 +36,12 @@ The `Register-ArgumentCompleter` cmdlet registers a custom argument completer. A completer allows you to provide dynamic tab completion, at run time for any command that you specify. +When you call this command with the **CommandName** parameter and without the **ParameterName** or +**Native** parameters, the command runs as if you specified the **Native** parameter. This prevents +the argument completer from working for PowerShell command parameters. Always specify the +**ParameterName** parameter when you want to register an argument completer for a PowerShell +command. + ## EXAMPLES ### Example 1: Register a custom argument completer @@ -182,6 +188,10 @@ cannot be an enumerated value, such as the **ForegroundColor** parameter of the For more information on enums, see [about_Enum](./About/about_Enum.md). +When registering an argument completer for a specific PowerShell command, always specify this +parameter. When you specify the **CommandName** parameter without the **ParameterName** or +**Native** parameters, the command behaves as if you specified the **Native** parameter. + ```yaml Type: System.String Parameter Sets: PowerShellSet diff --git a/reference/7.5/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md b/reference/7.5/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md index 57b0db5dc80a..c0c605e8de79 100644 --- a/reference/7.5/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md +++ b/reference/7.5/Microsoft.PowerShell.Core/Register-ArgumentCompleter.md @@ -2,7 +2,7 @@ external help file: System.Management.Automation.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Core -ms.date: 12/09/2022 +ms.date: 07/10/2024 online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/register-argumentcompleter?view=powershell-7.5&WT.mc_id=ps-gethelp schema: 2.0.0 title: Register-ArgumentCompleter @@ -36,6 +36,12 @@ The `Register-ArgumentCompleter` cmdlet registers a custom argument completer. A completer allows you to provide dynamic tab completion, at run time for any command that you specify. +When you call this command with the **CommandName** parameter and without the **ParameterName** or +**Native** parameters, the command runs as if you specified the **Native** parameter. This prevents +the argument completer from working for PowerShell command parameters. Always specify the +**ParameterName** parameter when you want to register an argument completer for a PowerShell +command. + ## EXAMPLES ### Example 1: Register a custom argument completer @@ -182,6 +188,10 @@ cannot be an enumerated value, such as the **ForegroundColor** parameter of the For more information on enums, see [about_Enum](./About/about_Enum.md). +When registering an argument completer for a specific PowerShell command, always specify this +parameter. When you specify the **CommandName** parameter without the **ParameterName** or +**Native** parameters, the command behaves as if you specified the **Native** parameter. + ```yaml Type: System.String Parameter Sets: PowerShellSet