commandlineparser / commandlineparser/commandline

Announcing CommandLineParser v2.9.0-preview1

Offen
#670 2 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
announcement
Vorherrschende Sprache
C#
Sterne
4.8k
Forks
478
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

CommandLineParser `v2.9.0-preview1` is releases Today (july 24, 2020) with new features.
The package can be downloaded from:

C#: https://www.nuget.org/packages/CommandLineParser/2.9.0-preview1
F#: https://www.nuget.org/packages/CommandLineParser.Fsharp/2.9.0-preview1

What is new in that version, read [Changelog](https://github.com/commandlineparser/commandline/blob/develop/CHANGELOG.md#290-preview1---2020-7-24)

The new features:
- Multi-instance option support.
option can be repeated as:
```$ myprog -t value1 -t value2 -t value3```
Configure Parser as:
```cs
var parser= new Parser(with =>{
with.AllowMultiInstance =true;
});
```
- Move Errors and Value up to the abstract class definition.
you can extract Options object or Parser Errors from ResultSet:
```cs
var result = parser.ParseArguments(args);
//extract Options object and errors
Options options= result.Value;
var Errors = result.Errors;
```
- Add support for flags enums.
see [wiki](https://github.com/commandlineparser/commandline/wiki/Enum-Flags)
- Implement verb aliases.
```cs
[Verb("copy", aliases: new string[] { "cp", "cpy" }, HelpText = "Copy some stuff")]
public class CopyVerb
{
//....
}
```
You can use verb alias:
```
$ myprg copy -f file.txt
$ myprg cp -f file.txt # use alias
$ myprg cpy -f file.txt # use alias
```
- New Unparsing Extension method is added: `FormatCommandLineArgs` to return array of strings.
see [wiki](https://github.com/commandlineparser/commandline/wiki/Unparsing#unparsing-to-array-of-strings)
- New string extension method `SplitArgs` to split commandline string with handling double quote with/o keeping the double quote and ignoring the extra spaces in the string.
```cs
var myargs="-a xyz --name \"path to file\" -b 123";
string[] args =myargs.SplitArgs(); //return {"-a","xyz","--name","path to file", "-b", "123"}
string[] args =myargs.SplitArgs(true); //keep quote and return {"-a","xyz","--name","\"path to file\"", "-b", "123"}
```
- Allow single dash as a value, now it's allowed: `-a - --filename -` .

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginnen Sie mit CHANGELOG.md beim Eintrag 2.9.0-preview1 und den verlinkten Wiki-Seiten zu Enum Flags und unparsing. Das Issue listet die Funktionen des Releases auf, nennt aber weder eine noch ausstehende Änderung noch eine überprüfbare Definition of Done.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, fsharp
Bereich
documentation, release
Issue-Typ
Dokumentation
Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.