PowerShell / PowerShell/PowerShell-RFC
Handling enums as cmdlet parameters.
Nessuno ha ancora preso questa issue.
- Lingua principale
- PowerShell
- Stelle
- 467
- Fork
- 140
- Merge medio
- 9m
- PR unite (30g)
- 1
Descrizione
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().
#>
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con l’issue #396 e riproduci l’esempio di completamento dei parametri del cmdlet enum usando valori enum duplicati. Analizza il punto di ingresso del completamento dei parametri che attualmente ottiene i valori enum, quindi verifica che il completamento esponga ogni nome, inclusi alias come Skip, New e Detete, senza suggerimenti duplicati basati sui valori.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- powershell
- Ambito
- cli
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100