Skip to content

Commit 04cb406

Browse files
committed
Add notes
1 parent 145c59a commit 04cb406

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/run/main-annotation-newMain.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ final class newMain extends MainAnnotation:
236236
override def argGetter[T](idx: Int, optDefaultGetter: Option[() => T])(using p: Parser[T]): () => T =
237237
val name = parameterInfos(idx).name
238238
val parameterInfo = nameToParameterInfo(name)
239-
239+
// TODO: Decide which string is associated with this arg when constructing the command.
240+
// Here we should only get the string for this argument, apply it to the parser and handle parsing errors.
241+
// Should be able to get the argument from its index.
240242
byNameArgs.get(name) match {
241243
case Some(Nil) =>
242244
throw AssertionError(s"$name present in byNameArgs, but it has no argument value")
@@ -259,7 +261,9 @@ final class newMain extends MainAnnotation:
259261

260262
override def varargGetter[T](using p: Parser[T]): () => Seq[T] =
261263
val name = parameterInfos.last.name
262-
264+
// TODO: Decide which strings are associated with the varargs when constructing the command.
265+
// Here we should only get the strings for this argument, apply them to the parser and handle parsing errors.
266+
// Should be able to get the argument from its index (last).
263267
val byNameGetters = byNameArgs.getOrElse(name, Seq()).map(arg => convert(name, arg))
264268
val positionalGetters = positionalArgs.removeAll.map(arg => convert(name, arg))
265269
// First take arguments passed by name, then those passed by position

0 commit comments

Comments
 (0)