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...
}
}