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

caseapp.core.parser.PlatformArgsExpander.scala Maven / Gradle / Ivy

There is a newer version: 2.0.0-M8
Show newest version
package caseapp.core.parser

import java.nio.charset.StandardCharsets.UTF_8
import java.nio.file._
import scala.compat.Platform.EOL

object PlatformArgsExpander {

  def expand(args: List[String]): List[String] = {
    args.flatMap { arg =>
      if (arg.startsWith("@")) {
        val argPath = Paths.get(arg.substring(1))
        val argText = new String(Files.readAllBytes(argPath), UTF_8)
        argText.split(EOL).map(_.trim).filter(_.nonEmpty).toList
      } else {
        List(arg)
      }
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy