5 c# command-line-arguments .net-core dragonfruit
我正在使用System.CommandLine.DragonFruit来处理命令行参数。如果可执行文件中发生错误,我想输出与“--help”选项自动输出相同的帮助文本。有没有我可以调用的方法来输出此帮助文本?
几个月前我需要完全相同的东西,不幸的是找不到内置的方法来做到这一点。
我发现的解决方法是使用ExecuteAssembly
带有--help
参数的DragonFruit 的辅助方法来调用自动生成的类。
无论如何,这就是 DragonFruit 在幕后所做的。
System.CommandLine.DragonFruit.CommandLine.ExecuteAssembly(typeof(AutoGeneratedProgram).Assembly, new string[] { "--help" }, "");
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
394 次 |
最近记录: |