@@ -11,28 +11,40 @@ import NameKinds.DefaultGetterName
11
11
import Annotations .Annotation
12
12
13
13
/** Generate proxy classes for main functions.
14
- * A function like
15
- *
16
- * /* *
17
- * * Lorem ipsum dolor sit amet
18
- * * consectetur adipiscing elit.
19
- * *
20
- * * @param x my param x
21
- * * @param ys all my params y
22
- * */
23
- * @main(80) def f(x: S, ys: T*) = ...
24
- *
25
- * would be translated to something like
26
- *
27
- * final class f {
28
- * @static def main(args: Array[String]): Unit =
29
- * val cmd: MainAnnotation#Command[..., ...] =
30
- * (new scala.main(80)).command(args, "f", "Lorem ipsum dolor sit amet consectetur adipiscing elit.")
31
- * val arg1: () => S = cmd.argGetter[S]("x", "S", "my param x")
32
- * val arg2: () => Seq[T] = cmd.argsGetter[T]("ys", "T", "all my params y")
33
- * cmd.run(f(arg1(), arg2()*))
34
- * }
35
- */
14
+ * A function like
15
+ *
16
+ * /* *
17
+ * * Lorem ipsum dolor sit amet
18
+ * * consectetur adipiscing elit.
19
+ * *
20
+ * * @param x my param x
21
+ * * @param ys all my params y
22
+ * */
23
+ * @main(80) def f(@main.arg(shortName = 'x', name = "myX") x: S, ys: T*) = ...
24
+ *
25
+ * would be translated to something like
26
+ *
27
+ * final class f {
28
+ * static def main(args: Array[String]): Unit = {
29
+ * val cmd = new main(80).command(args, "f", "Lorem ipsum dolor sit amet consectetur adipiscing elit.")
30
+ *
31
+ * val args0: () => S = cmd.argGetter[S]({
32
+ * val args0paramInfos = new scala.annotation.MainAnnotation.ParameterInfos[S]("x", "S")
33
+ * args0paramInfos.documentation = Some("my param x")
34
+ * args0paramInfos.annotation = Some(new scala.main.arg(name = "myX", shortName = 'x'))
35
+ * args0paramInfos
36
+ * })(util.CommandLineParser.FromString.given_FromString_Int)
37
+ *
38
+ * val args1: () => Seq[T] = cmd.varargGetter[T]({
39
+ * val args1paramInfos = new scala.annotation.MainAnnotation.ParameterInfos[T]("ys", "T")
40
+ * args1paramInfos.documentation = Some("all my params y")
41
+ * args1paramInfos
42
+ * })(util.CommandLineParser.FromString.given_FromString_String)
43
+ *
44
+ * cmd.run(f(args0.apply(), args1.apply()*))
45
+ * }
46
+ * }
47
+ */
36
48
object MainProxies {
37
49
38
50
def mainProxies (stats : List [tpd.Tree ])(using Context ): List [untpd.Tree ] = {
0 commit comments