[英]switsh and helpSwitch methods missing from org.refcodes.console.ConsoleSugar when upgrading to 2.x
I was using org.refcode.refcodes-console version 1.1.9.我使用的是 org.refcode.refcodes-console 版本 1.1.9。 When upgrading to 2.0.4, it seems various methods no longer exist.升级到 2.0.4 时,似乎各种方法都不复存在了。
My scala code:我的 Scala 代码:
val theHelp = helpSwitch("Shows this help")
I get this error when compiling: not found: value helpSwitch
编译时出现此错误: not found: value helpSwitch
Same error when using switsh
and StringOptionImpl
.使用switsh
和StringOptionImpl
时出现同样的错误。
How should I replace them when migrating from 1.x to 2.x for this maven artifact?为这个 maven 工件从 1.x 迁移到 2.x 时,我应该如何替换它们?
All 'switch' (aka switsh) methods in ConsoleSugar have been renamed to 'flag' in major version 2. So 'switsh' has been renamed to 'flag' and 'helpSwitch' has been renamed to 'helpFlag'. ConsoleSugar 中的所有“switch”(又名 switsh)方法在主要版本 2 中都已重命名为“flag”。因此,“switsh”已重命名为“flag”,而“helpSwitch”已重命名为“helpFlag”。 For StringOptionImpl, use 'SpringOption' instead.对于 StringOptionImpl,请改用“SpringOption”。
So in the example provided, it should now be:所以在提供的例子中,它现在应该是:
val theHelp = helpFlag("Shows this help")
Also, for the switsh method you would need to add a 'aAlias' parameter as the third parameter.此外,对于 switsh 方法,您需要添加一个“aAlias”参数作为第三个参数。 For example:例如:
val block = switsh("-w", "--wait", "Wait at the end of the Program")
would need to be something like become需要成为类似的东西
val block = flag("-w", "--wait", "wait", "Wait at the end of the Program")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.