commandlineparser / commandlineparser/commandline

Add MapResult example to HelpText Configuration Wiki

Aperta
#602 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
4.8k
Fork
478
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Please add the following example to the https://github.com/commandlineparser/commandline/wiki/HelpText-Configuration page.

```
class Program {
static int Main(string[] args) {
var parserResult = new Parser(c => c.HelpWriter = null).ParseArguments(args);
return parserResult.MapResult(
(Options opts) => new Run(opts),
errs => DisplayHelp(parserResult, errs)
);
}

static int DisplayHelp(ParserResult parserResult, IEnumerable errs) {
Console.WriteLine(HelpText.AutoBuild(parserResult, h => {
h.AddPreOptionsLine(Environment.NewLine + "Use this tool wisely!");
return h;
}));
return 1;
}
}
```

Also I had a great trouble finding this page, please add more links to it.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.