You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by kincsescsaba August 7, 2024
Hey there,
I'm not sure if this is an issue or more like a feature request, but when I try to place the @main annotation of mainargs in a trait, that is mixed into the class that contains the main method, I get a No @main methods declared error.
I tried referencing the self type from ParserForMethods but that did not fix the issue.
Here's how the approach looks like:
abstractclassCaskMainWithArgsextends cask.Main:self: Conf=>privatevarargs_:Seq[String] = uninitialized
defargs:Seq[String] = args_
overridedefmain(argsArray: Array[String]):Unit=ifOption(args_).isEmpty then
args_ = argsArray.toSeq
ParserForMethods(self).runOrExit(argsArray)
super.main(argsArray)
traitConf:self: CaskMainWithArgs=>@main
defrunConfInit(@arg(name ="conf", short ='c', doc ="Set a custom configuration file")
configFile: String) =
println("Hello from runConfInit")
Any ideas on how this behavior could be implemented?
The text was updated successfully, but these errors were encountered:
Discussed in #144
Originally posted by kincsescsaba August 7, 2024
Hey there,
I'm not sure if this is an issue or more like a feature request, but when I try to place the
@main
annotation ofmainargs
in a trait, that is mixed into the class that contains the main method, I get aNo @main methods declared
error.I tried referencing the self type from
ParserForMethods
but that did not fix the issue.Here's how the approach looks like:
Any ideas on how this behavior could be implemented?
The text was updated successfully, but these errors were encountered: