有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

组织中缺少java switsh和helpSwitch方法。参考代码。安慰当升级到2时,ConsoleSugar。十、

我用的是org。参考代码。参考代码控制台版本1.1.9。当升级到2.0.4时,各种方法似乎不再存在

我的scala代码:

val theHelp =  helpSwitch("Shows this help")

我在编译时遇到此错误:not found: value helpSwitch

使用switshStringOptionImpl时出现相同错误

从1迁移时应如何替换它们。x比2。这个maven工件的x


共 (1) 个答案

  1. # 1 楼答案

    在主要版本2中,ConsoleSugar中的所有“switch”(又名switsh)方法都已重命名为“flag”。因此,“switsh”已重命名为“flag”,而“helpSwitch”已重命名为“helpFlag”。 对于StringOptionImpl,请改用“SpringOption”

    因此,在提供的示例中,现在应该是:

    val theHelp =  helpFlag("Shows this help")
    

    此外,对于switsh方法,您需要添加一个'aAlias'参数作为第三个参数。例如:

    val block = switsh("-w", " wait", "Wait at the end of the Program")
    

    需要变成什么样子

    val block = flag("-w", " wait", "wait", "Wait at the end of the Program")