EntryPoint
1.3.0 - Make getters for BaseOptionAttribute public
所有現代.NET平台的組合CLI參數解析器
用form UtilityName [command] [-o | --options] [operands]
支持:
緊密遵循IEEE標準,但確實包含常見的adblibs,例如完全命名的Option --option選項。
Nuget上有入門點:
PM> Install-Package EntryPoint
歡迎拉動請求和建議,並且已經存在一些小任務。
完整文檔:https://nick-lucas.github.io/entrypoint/
示例實現:https://github.com/nick-lucas/entrypoint/tree/master/master/test/example
將您的應用程序的命令行參數解析為一行聲明的POCO。
參數定義為使用屬性的聲明性POCO。
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...
}
}