DontShow should not hide common parameters
See original GitHub issueSummary of the new feature / enhancement
The DontShow attribute parameter that the Parameter attribute has allows a function/script author to hide parameters like this:
function Verb-Noun
{
Param
(
[Parameter()]
[string]
$Param1,
[Parameter(DontShow)]
[string]
$Param2
)
}
#Tab completion does not show Param2
Verb-Noun -<Tab>
This has the side effect of also hiding the common parameters.
It seems to have been an intentional design choice, see this: https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs#L768 but I think that should be changed because it makes it impractical to use DontShow
to hide old deprecated parameters like ConvertTo-Csv
does with the NoTypeInformation
parameter because then the user won’t see important common parameters like ErrorAction
.
Proposed technical implementation details (optional)
Instead of automatically hiding common parameters when DontShow
has been specified, add a HideCommonParameters
parameter to the CmdletBinding
attribute.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (6 by maintainers)
So what’s your point here? That nobody would want to hide the common parameters for a random script with a mandatory parameter?
I’m sure I’m not the only one that has done something like this in a script where I needed a mandatory parameter but didn’t want to confuse the user with the common parameters:
Just to be clear here, I’m obviously not arguing to keep the current behavior, I’m just saying that if we fix the current behavior we need to provide an alternative for the people that actually wants to hide common parameters.
@theJasonHelmick Any update from the working group?