PowerShell / PowerShell/PowerShell-RFC

Handling enums as cmdlet parameters.

未关闭
#396 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
PowerShell
星标
467
派生
140
平均合并
9 分钟
30 天内合并 PR
1

描述

Summary of the new feature / enhancement

Changing the handling of enums as cmdlet parameters uses to display the possible values the values of the enum and the get the name for the value. Therefore xou get the same text if more than one name has the same value (see example below).

Proposed technical implementation details (optional)

<#
Display option when using an enum as a parameter of an CmdLet.
#>

Enum TestAction
{
Ignore = 0
Skip = 0
Replace = 1
New = 1
Remove = 2
Detete = 2

} # Enum TestAction

Function Test-Enum
{
param
(
[Parameter( Mandatory )]
[TestAction]
$Action
)
<#Do something#>

} # Function Test-Enum

<#
If you enter on a prompt
Test-Enum -Action
and try to select an action you get the following sequence:
Ignore
Ignore
Replace
Replace
Remove
Remove
Ignore
It would be nice to get the alias names as well.
Use [enum]::GetNames() instead [enum]::GetValues().
#>

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue #396 开始,使用重复的 enum 值复现 enum cmdlet 参数补全示例。调查当前获取 enum 值的参数补全入口点,然后验证补全会暴露每个名称,包括 Skip、New 和 Detete 等别名,且不会产生基于值的重复建议。

由索引模型根据 Issue 内容生成。

评估

技术栈
powershell
领域
cli
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。