Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShowCommandHelp and ShowParameterHelp should support incomplete parameter names (prefixes) #3560

Open
1 task done
mklement0 opened this issue Feb 1, 2023 · 3 comments
Open
1 task done
Labels
Area-CommandHelp Label for issues related to ShowCommandHelp and the pager Issue-Enhancement It's a feature request.

Comments

@mklement0
Copy link

Prerequisites

  • Write a descriptive title.

Description of the new feature/enhancement

Currently, for said functions to recognize a parameter and jump to the relevant section in the help file / show the parameter type and description below the command line it must be spelled out in full.

# OK, parameter name spelled out in full
Get-Item -LiteralPath<Alt-h>

# !! NO-OP, because the the parameter name is only identified *by prefix*, not spelled out in full.
Get-Item -Lit<Alt-h>

While tab-completing a parameter-name prefix first bypasses the problem, the need to do so is surprising, given that a unique prefix is sufficient for invocation of a command.

If the prefix isn't unique (e.g. Get-ChildItem -F<Alt-h>), I suggest resolving the problem as follows:

  • ShowCommandHelp: jump to the first parameter with the given prefix.
  • ShowParameterHelp: either do nothing, or display a message indicating the ambiguity.

Proposed technical implementation details (optional)

No response

@mklement0 mklement0 added the Issue-Enhancement It's a feature request. label Feb 1, 2023
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Feb 1, 2023
@StevenBucher98
Copy link
Collaborator

I think the necessary changes would have to be made in Get-Help since all PSReadLine does is make a key handler to call that function.

@StevenBucher98 StevenBucher98 added Resolution-External and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Mar 6, 2023
@ghost ghost closed this as completed Mar 7, 2023
@mklement0
Copy link
Author

mklement0 commented Mar 7, 2023

@StevenBucher98:

PSReadLine has control over how how it invokes Get-Help, and the fact that it uses Get-Help at all is an implementation detail.

It should exercise that control in order to translate Get-Item -Lit<Alt-h> to Get-Help Get-Item -Parameter Lit*

Closing this issue as Resolution-External is inappropriate.

@daxian-dbw daxian-dbw added Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. and removed Resolution-External labels Mar 7, 2023
@daxian-dbw daxian-dbw reopened this Mar 7, 2023
@StevenBucher98 StevenBucher98 added Area-CommandHelp Label for issues related to ShowCommandHelp and the pager and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Mar 27, 2023
@mattcargile
Copy link

mattcargile commented Aug 1, 2024

To hop onto this Issue. Explicit Parameter aliases should be supported too like the ones defined as a [Alias()] attribute.

For instance, the below doesn't work with Alt + h.

icm -HCN

Additionally it would be nice if get-help icm -parameter hcn worked too. Using command aliases works, so I would assume parameter aliases should work at least the explicit ones.

Just linked the Powershell\Powershell repo Issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CommandHelp Label for issues related to ShowCommandHelp and the pager Issue-Enhancement It's a feature request.
Projects
None yet
Development

No branches or pull requests

4 participants