【发布时间】:2020-04-12 07:47:54
【问题描述】:
我使用System.CommandLine.DragonFruit 来处理命令行参数。如果可执行文件中发生错误,我想输出“--help”选项自动输出的相同帮助文本。有没有我可以调用的方法来输出此帮助文本?
【问题讨论】:
标签: c# .net-core command-line-arguments dragonfruit
我使用System.CommandLine.DragonFruit 来处理命令行参数。如果可执行文件中发生错误,我想输出“--help”选项自动输出的相同帮助文本。有没有我可以调用的方法来输出此帮助文本?
【问题讨论】:
标签: c# .net-core command-line-arguments dragonfruit
几个月前我需要完全相同的东西,遗憾的是找不到内置的方法。
我找到的解决方法是使用 DragonFruit 的辅助方法 ExecuteAssembly 和 --help 参数来调用自动生成的类。
这就是 DragonFruit 在幕后所做的。
System.CommandLine.DragonFruit.CommandLine.ExecuteAssembly(typeof(AutoGeneratedProgram).Assembly, new string[] { "--help" }, "");
【讨论】: