PowerShell / PowerShell/PowerShell
Advance Function's Parameter's Get-Help is inconsistent if comment-based help is used (missing Alias, Default Value, Parameter Set, etc.)
未关闭
还没有人认领这个 Issue。
KeepOpen
Up-for-Grabs
WG-Interactive-HelpSystem
WG-Reviewed
- 主要语言
- C#
- 星标
- 55.5k
- 派生
- 8.5k
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 88
描述
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Enter in the following code
function Test-GreetingA {
[CmdletBinding()]
param (
[Parameter(
Position = 0,
Mandatory,
ValueFromPipeline
)]
[Alias(
'Subject'
)]
[string]
$Person
)
begin {
}
process {
Write-Output "Hello $Person"
}
end {
}
}
<#
.SYNOPSIS
Test a simple greeting
.DESCRIPTION
A simple greeting that requires a person's name
.PARAMETER Person
The person you want to greet
.EXAMPLE
Test-Greeting -Person 'John Smith'
#>
function Test-GreetingB {
[CmdletBinding()]
param (
[Parameter(
Position = 0,
Mandatory,
ValueFromPipeline
)]
[Alias(
'Subject'
)]
[string]
$Person
)
begin {
}
process {
Write-Output "Hello $Person"
}
end {
}
}
Now run the following Get-Help commands
Get-Help Test-GreetingA -Parameter Person
Get-Help Test-GreetingB -Parameter Person
Expected behavior
-Person <string>
Required? true
Position? 0
Default value None
Accept pipeline input? true (ByValue)
Parameter set name (All)
Aliases Subject
Dynamic? false
Accept wildcard characters? false
-Person <String>
The person you want to greet
Required? true
Position? 0
Default value None
Accept pipeline input? true (ByValue)
Parameter set name (All)
Aliases Subject
Dynamic? false
Accept wildcard characters? false
Actual behavior
-Person <string>
Required? true
Position? 0
Accept pipeline input? true (ByValue)
Parameter set name (All)
Aliases Subject
Dynamic? false
Accept wildcard characters? false
-Person <String>
The person you want to greet
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Aliases
Accept wildcard characters? false
Error details
Incorrect output includes (disparity between Get-Help's output for Test-GreetingA vs. Test-GreetingB):
- 'Default value' is missing (A)
- 'Position' is incremented (B)
- 'Parameter set name' is missing (B)
- 'Dynamic' is missing (B)
- 'Default value' right hand value is not showing (B)
- 'Aliases' right hand value is not showing (B)
Environment data
Name Value
---- -----
PSVersion 7.5.1
PSEdition Core
GitCommitId 7.5.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用两个函数 Test-GreetingA 和 Test-GreetingB 重现差异,然后比较它们的 Person 参数的 Get-Help 输出。当基于注释的帮助与基于语法的帮助一致地保留预期的 Default 值、Position、Parameter set name、Aliases、Dynamic 及相关字段时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- powershell
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100