Komponierbarer CLI -Argument -Parser für alle modernen .NET -Plattformen
Pariert Argumenten im Formular UtilityName [command] [-o | --options] [operands]
Unterstützung:
Folgt dem IEEE -Standard genau, enthält jedoch gängige Adblibs wie voll benannte Optionen für den Option --option .
Einstiegspunkt ist auf Nuget verfügbar:
PM> Install-Package EntryPoint
Anfragen und Vorschläge sind willkommen, und einige kleine Aufgaben sind bereits in den Problemen.
Vollständige Dokumentation: https://nick-lucas.github.io/entrypoint/
Beispiel Implementierung: https://github.com/nick-lucas/entrypoint/tree/master/test/example
Nehmen Sie die Befehlszeilenargumente Ihrer Anwendung in einen deklarativen POCO in einer Zeile an.
Argumente werden als deklarative Pocos unter Verwendung von Attributen definiert.
var arguments = Cli . Parse < CliArguments > ( args ) ;
if ( arguments . Option ) {
// ...
} ; public class CliArguments : BaseCliArguments {
public CliArguments ( ) : base ( "MyApplication" ) { }
[ Option ( ShortName : 'o' ,
LongName : "option-1" ) ]
public bool Option { get ; set ; }
}Befehle haben eine dedizierte API:
Cli . Execute < CliCommands > ( args ) ; public class CliCommands : BaseCliCommands {
[ Command ( "primary" ) ]
public void Primary ( string [ ] args ) {
// Arguments Parsing and Command Code...
}
}