dotnet / dotnet/command-line-api
Implementing a default command
- Vorherrschende Sprache
- C#
- Sterne
- 3.7k
- Forks
- 428
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I have an app using System.CommandLine which has two commands: `compile` and `run`, which are invoked using `myapp compile path/to/some.file path/to/other.file` and `myapp run path/to/some.file` respectively. However, I would like users to not necessarily have to specify `compile`, and instead just be able to do `myapp path/to/some.file path/to/other.file` to invoke `compile` implicitly. This is akin to how `dotnet path/to/some.file` is essentially an alias for `dotnet exec path/to/some.file`, and if you look at the help text for `dotnet --help` you'll see that it gives two separate usages. Is this possible to implement using System.CommandLine?
Beitragsleitfaden
Rechercherichtung
Beginne damit, die Parsing- und Invocation-Einstiegspunkte von System.CommandLine zu lesen, um zu verstehen, wie Befehle aus der Argumentliste ausgewählt werden. Lege fest, wie ein weggelassener Befehl `compile` neben den bestehenden Formen `compile` und `run` erkannt werden soll, wie die Hilfe beide Verwendungen darstellen soll, und ergänze Tests für die Beispiele im Issue.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp
- Bereich
- cli
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100