Skip to content

Extend Get-Help to support online documentation lookup for built-in .NET types #11338

@mklement0

Description

@mklement0

See also:

Summary of the new feature/enhancement

Get-Help supporting online lookup of documentation for built-in .NET types (those that ship with the framework / PowerShell) would be ... uh ... helpful, given:

Both looking up by type name alone as well as a combination of type name and member name (to get help for a specific method, for instance) would be beneficial.

Proposed technical implementation details (optional)

Note that since .NET documentation is only available online, conceptually -Online is implied when targeting .NET types.

Here's how it could work:

# WISHFUL THINKING

# Opens the documentation for the System.String.Split() method.
# Note:
#  You can specify a type name ('string' in this example) as follows:
#    * Use a full type name, with the initial 'System.' component optionally omitted (e.g. 'Text.Encoding' for 'System.Text.Encoding'
#    * Use a PowerShell type accelerator such as 'xml' for 'System.Xml.XmlDocument'
# Tab-completion can assist: You can type (part of) a the name of a type
# (last component of the full name) and cycle through loaded types by that name.
# E.g., typing `arrayli` tab-completes to 'System.Collections.ArrayList', which is the 
# Alternatively, *pipe* an instance of a string to the function (see next example).
Get-Help -Type string -Member split

# Opens the documentation for the [Microsoft.PowerShell.Commands.MatchInfo]
# type, instances of which Select-String outputs.
'foo' | Select-String o | Get-Help 

Note:

  • Technically, Get-Help currently binds the -Name parameter by property value from the pipeline, but that appears to be broken anyway (and I've never seen it in the wild). Therefore binding pipeline objects to a new -InputObject parameter whose (distinct set of ) types are to be looked up should work.

    • Being able to do something like 'foo'.Split | Get-Help would be great, but, unfortunately, the resulting PSMethodInfo instances contain no information about the enclosing type.
  • The lookup URL should include a ?view=netcore-<major>.<minor> / ?view=netframework-<major>.<minor> query string reflecting the .NET platform underlying the executing PowerShell engine.

  • For an implementation of this functionality as PowerShell function Show-TypeHelp (focused on .NET type lookup only), see this Stack Overflow answer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreWG-Interactive-HelpSystemhelp infrastructure and formatting of help

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions