Powershell: -syntax switch with aliases give definition instead of true syntax

Created on 21 Oct 2018  路  4Comments  路  Source: PowerShell/PowerShell

get-command return the definition of aliases instead of syntax...it will be nice if -syntax switch return the definition for the powershell core running in windows system....why hiding important help information ?

Steps to reproduce

PS C:\> gcm sort -Syntax
Sort-Object

it return the definition of cmdlet for all alias

PS C:\> Get-Alias | Select-Object  name | Get-Command -Syntax

Expected behavior

PS C:\> gcm sort -Syntax
Sort-Object [[-Property] <Object[]>] [-Descending] [-Unique] [-Top <int>] [-InputObject <psobject>]
[-Culture <string>] [-CaseSensitive] [<CommonParameters>]

Sort-Object [[-Property] <Object[]>] -Bottom <int> [-Descending] [-Unique] [-InputObject <psobject>]
 [-Culture <string>] [-CaseSensitive] [<CommonParameters>]

Actual behavior

sort-object

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.1.0
PSEdition                      Core
GitCommitId                    6.1.0
OS                             Microsoft Windows 6.3.9600
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Area-Cmdlets-Core Issue-Discussion

All 4 comments

Good idea; closely related to #7387.

Not closely, I would say it as a duplicate of #7387

@kvprasoon:

Virtually, yes, because if -Resolve gets implemented as proposed in #7387, I would expect the following to work:

Get-Command -Syntax -Resolve sort

Where this issue differs is that it asks for -Syntax _by itself_ to show the resolved command's syntax - which makes sense.

In short: I suggest we _both_:

  • modify -Syntax _itself_ as proposed by this issue.

  • implement -Resolve as proposed in #7387, for name and symlink-target resolution.

Combining -Resolve with -Syntax would then be the same as specifying -Syntax alone.

Yup makes sense, I missed the -syntax part 馃檪

Was this page helpful?
0 / 5 - 0 ratings