EntryPoint
1.3.0 - Make getters for BaseOptionAttribute public
すべての最新の.NETプラットフォーム用のComposable CLI引数パーサー
Form UtilityName [command] [-o | --options] [operands]
サポート:
IEEE標準に密接に従いますが、完全に指定された--optionスタイルオプションなどの一般的なADBLIBが含まれます。
EntryPointはNUGETで利用できます:
PM> Install-Package EntryPoint
リクエストと提案をプルすることは歓迎されており、いくつかの小さなタスクはすでに問題にあります。
完全なドキュメント:https://nick-lucas.github.io/entrypoint/
実装の例:https://github.com/nick-lucas/entrypoint/tree/master/test/example
アプリケーションのコマンドライン引数を1行で宣言的なPocoに解析します。
引数は、属性を使用して宣言的なPOCOSとして定義されます。
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 ; }
}コマンドには専用のAPIがあります:
Cli . Execute < CliCommands > ( args ) ; public class CliCommands : BaseCliCommands {
[ Command ( "primary" ) ]
public void Primary ( string [ ] args ) {
// Arguments Parsing and Command Code...
}
}