CommandLineParser

scala.util.CommandLineParser

A utility object to support command line parsing for @main methods.

Attributes

Source
CommandLineParser.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object FromString

Attributes

Companion
trait
Source
CommandLineParser.scala
Supertypes
class Object
trait Matchable
class Any
Self type
FromString.type
trait FromString[T]

Attributes

Companion
object
Source
CommandLineParser.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ParseError(val idx: Int, val msg: String) extends Exception

An exception raised for an illegal command line.

An exception raised for an illegal command line.

Value parameters

idx

The index of the argument that's faulty (starting from 0)

msg

The error message

Attributes

Source
CommandLineParser.scala
Supertypes
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def parseArgument[T](args: Array[String], n: Int)(using fs: FromString[T]^): T

Parses n'th argument in args (counting from 0) as a value of type T.

Parses n'th argument in args (counting from 0) as a value of type T.

Attributes

Throws

ParseError if argument does not exist or cannot be converted to type T.

Source
CommandLineParser.scala
def parseRemainingArguments[T](args: Array[String], n: Int)(using fs: FromString[T]^): List[T]

Parses all arguments from n'th one (counting from 0) as a list of values of type T.

Parses all arguments from n'th one (counting from 0) as a list of values of type T.

Attributes

Throws

ParseError if some of the arguments cannot be converted to type T.

Source
CommandLineParser.scala
def parseString[T](str: String, n: Int)(using fs: FromString[T]^): T

Parses command line argument s, which has index n, as a value of type T.

Parses command line argument s, which has index n, as a value of type T.

Attributes

Throws

ParseError if argument cannot be converted to type T.

Source
CommandLineParser.scala

Prints error message explaining given ParserError.

Prints error message explaining given ParserError.

Attributes

Source
CommandLineParser.scala