Skip to content

Commit

Permalink
Rename defaultValueOpt for clearer name
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeandres committed Dec 9, 2021
1 parent fa9a7f3 commit 81ebb1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions library/src/scala/annotation/MainAnnotation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object MainAnnotation:
/** The docstring of the parameter. Defaults to None. */
val documentation: Option[String],
/** The default value that the parameter has. Defaults to None. */
val defaultValueOpt: Option[() => T],
val defaultValueGetterOpt: Option[() => T],
/** The ParameterAnnotations associated with the parameter. Defaults to Seq.empty. */
val annotations: Seq[ParameterAnnotation],
) {
Expand All @@ -46,10 +46,10 @@ object MainAnnotation:
new ParameterInfos(name, typeName, documentation, Some(() => defaultValue), annotations)

def withDocumentation(doc: String): ParameterInfos[T] =
new ParameterInfos(name, typeName, Some(doc), defaultValueOpt, annotations)
new ParameterInfos(name, typeName, Some(doc), defaultValueGetterOpt, annotations)

def withAnnotations(annots: ParameterAnnotation*): ParameterInfos[T] =
new ParameterInfos(name, typeName, documentation, defaultValueOpt, annots)
new ParameterInfos(name, typeName, documentation, defaultValueGetterOpt, annots)

override def toString: String = s"$name: $typeName"
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ final class main(maxLineLength: Int) extends MainAnnotation:
checkNamesDuplicates(argShortNamess.last)

override def argGetter[T](paramInfos: ParameterInfos[T])(using p: ArgumentParser[T]): () => T =
val dvOpt = paramInfos.defaultValueOpt
val dvOpt = paramInfos.defaultValueGetterOpt
registerArg(paramInfos, if dvOpt.nonEmpty then ArgumentKind.OptionalArgument else ArgumentKind.SimpleArgument)

// registerArg placed all infos in the respective buffers
Expand Down

0 comments on commit 81ebb1e

Please sign in to comment.