dotnet / dotnet/command-line-api

Flowing data in System.CommandLine

Aperta
#2,162 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
needs discussion
Lingua principale
C#
Stelle
3.7k
Fork
428
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

There are a number within the System.CommandLine flow that could potentially supply information used by later steps. From one perspective this is a core part of the process because a return code (exit code) is returned that we anticipate will be the return value of Main.

#2156 discusses what should be returned from the flow. This the broader question about what state/data should be available during execution.

Several things could supply data that could be used by later steps:

* The calling code (often `static void Main(..)`
* Custom parsers
* Validators (beyond the validation failure info)
* Pre-actions (non-exclusive actions in #2147)
* CliAction (the action of the command, previously ICommandHandler)
* Post-actions if we have them (#2161)

In the old middleware pipeline, closures could be used to stash data between the before/after next step phases, but I do not think there were other ways to share state/data.

Have you ever wished a custom parser could stash some information for use by an action? Any other variation of wanting data to pass between parts of your parser?

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo questa issue insieme a #2156, #2147 e #2161, quindi confronta il flusso proposto con la vecchia pipeline di middleware e la relativa condivisione dello stato basata su closures. Il lavoro è completato quando si raggiunge un accordo sui dati che ogni passaggio di esecuzione può fornire ai passaggi successivi e su come tale stato sia correlato al valore restituito dal comando.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
cli
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.