diff --git a/build.sc b/build.sc index 237d926..0e8a9d1 100644 --- a/build.sc +++ b/build.sc @@ -1,8 +1,23 @@ +import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0` +import de.tobiasroeser.mill.vcs.version.VcsVersion + import mill._, scalalib._ +import publish._ -object qw extends RootModule with ScalaModule { +object qw extends RootModule with ScalaModule with PublishModule { def scalaVersion = "3.3.0" - def publishVersion = "0.1.1-SNAPSHOT" + def pomSettings = PomSettings( + description = artifactName(), + organization = "io.github.windymelt", + url = "https://github.com/windymelt/qw.scala", + licenses = Seq(License.MIT), + versionControl = VersionControl.github("windymelt", "qw.scala"), + developers = Seq( + Developer("windymelt", "windymelt", "https://github.com/windymelt") + ) + ) + override def publishVersion: T[String] = VcsVersion.vcsState().format() + object test extends ScalaTests with TestModule.Munit { def ivyDeps = Agg(ivy"org.scalameta::munit::0.7.29") } diff --git a/src/main/scala/io/github/windymelt/qw/Syntax.scala b/src/main/scala/io/github/windymelt/qw/Syntax.scala index 88ce652..fea2149 100644 --- a/src/main/scala/io/github/windymelt/qw/Syntax.scala +++ b/src/main/scala/io/github/windymelt/qw/Syntax.scala @@ -1,7 +1,27 @@ package io.github.windymelt.qw +/** Enables qw syntax for string. + * + * {{{ + * import io.github.windymelt.qw.Syntax.* + * qw"foo bar buzz" // => "foo" :: "bar" :: "buzz" :: Nil + * }}} + * + * You can use newline for separator too: + * + * {{{ + * qw""" + * new + * line + * separated + * """ // => "new" :: "line" :: "separated" :: Nil + * }}} + */ object Syntax: extension (sc: StringContext) + /** Splits strings with whitespace character and constructs + * [[List[String]]]. + */ def qw(args: String*): List[String] = val strings = sc.parts.iterator val expressions = args.iterator diff --git a/test/src/scala/com/github/windymelt/qw/SyntaxSuite.scala b/test/src/scala/io/github/windymelt/qw/SyntaxSuite.scala similarity index 100% rename from test/src/scala/com/github/windymelt/qw/SyntaxSuite.scala rename to test/src/scala/io/github/windymelt/qw/SyntaxSuite.scala