All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scala.build.options.publish.Developer.scala Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
package scala.build.options.publish

import scala.build.Positioned
import scala.build.errors.{BuildException, MalformedInputError}

final case class Developer(
  id: String,
  name: String,
  url: String,
  mail: Option[String] = None
)

object Developer {

  def parse(input: Positioned[String]): Either[BuildException, Developer] =
    input.value.split("\\|", 4) match {
      case Array(id, name, url) =>
        Right(Developer(id, name, url))
      case Array(id, name, url, mail) =>
        Right(Developer(id, name, url, Some(mail).map(_.trim).filter(_.nonEmpty)))
      case _ =>
        Left(
          new MalformedInputError("developer", input.value, "id|name|URL", input.positions)
        )
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy