-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
See also:
- Extend Get-Help to support focused lookup of documentation for PowerShell operators #11339
- Online support for about_... help topics #13550
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:
- the close integration between PowerShell and .NET types in general
- that there's no easy way to look up the types that PowerShell cmdlets outputs (
MatchInfo
comes to mind as a complex type whose documentation needs to be consulted to take full advantage of it - see also: Online versions of cmdlet help topics should link to the documentation for their output types in the "Outputs" section MicrosoftDocs/PowerShell-Docs#5221).
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 resultingPSMethodInfo
instances contain no information about the enclosing type.
- Being able to do something like
-
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.