寻找 .NET 的命令行参数解析器命令行、参数、NET

2023-09-06 18:15:09 作者:醉後抉定愛上你

我正在寻找一个命令行参数解析器,例如来自 http 的命令行解析器"://www.sellsbrothers.com/tools/Genghis/ .

I'm looking for a command line argument parser, such as "Command line parser" from http://www.sellsbrothers.com/tools/Genghis/ .

我正在寻找的功能:

自动生成使用情况应该能够检查必需和可选参数参数应支持带分隔符的 IEnumerable应该支持标志参数如果支持组合参数就好了,例如/fx"==/f/x"最好不要在诸如/ftest.txt"==/f test.txt"之类的参数之后强制使用空格

附注:命令行解析器"非常好,我真的很喜欢它的设计,但是没有文档,没有新的更新,而且我不知道如何做某些事情,例如如何检查所需的参数.

推荐答案

我个人最喜欢的 3rd 方命令行解析库是 命令行解析器,我认为这就是您所指的那个.最近的版本是不到 2 个月前,并且有定期提交.如果您想要更成熟的产品,您可以查看 mono 项目中的控制台库(抱歉,我目前似乎找不到指向命名空间的直接链接,但它是 mono 框架的一部分)

My personal favourite 3rd party commandline parsing library is Command Line Parser and I assume this is the one you are referring to. The most recent release was less than 2 months ago and there are regular commits. If you want a more mature offering you could chek out the console library in the mono project (sorry I can't seem to find a direct link to the namespace at the moment, but its a part of the mono framework)