【问题标题】:Outputting help using DragonFruit on demand按需输出使用 DragonFruit 的帮助
【发布时间】:2020-04-12 07:47:54
【问题描述】:

我使用System.CommandLine.DragonFruit 来处理命令行参数。如果可执行文件中发生错误,我想输出“--help”选项自动输出的相同帮助文本。有没有我可以调用的方法来输出此帮助文本?

【问题讨论】:

    标签: c# .net-core command-line-arguments dragonfruit


    【解决方案1】:

    几个月前我需要完全相同的东西,遗憾的是找不到内置的方法。

    我找到的解决方法是使用 DragonFruit 的辅助方法 ExecuteAssembly--help 参数来调用自动生成的类。

    这就是 DragonFruit 在幕后所做的。

    System.CommandLine.DragonFruit.CommandLine.ExecuteAssembly(typeof(AutoGeneratedProgram).Assembly, new string[] { "--help" }, "");
    

    【讨论】:

      猜你喜欢
      • 2021-10-23
      • 1970-01-01
      • 1970-01-01
      • 2022-01-01
      • 1970-01-01
      • 2016-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多