我正在使用org.refcode.refcodes-console版本1.1.9。升级到2.0.4时,似乎不再存在各种方法。

我的scala代码:

val theHelp =  helpSwitch("Shows this help")


编译时出现此错误:not found: value helpSwitch

使用switshStringOptionImpl时出现相同的错误。

从1.x到2.x的Maven工件迁移时,应该如何替换它们?

最佳答案

在主版本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")

10-07 19:48
查看更多