CommandLineParser

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

Source
CommandLineParser.scala
class Object
trait Matchable
class Any

Type members

Classlikes

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 Params
idx

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

msg

The error message

Source
CommandLineParser.scala

Value members

Concrete methods

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

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

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

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]

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

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

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

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

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

Throws
ParseError

if argument cannot be converted to type T.

Source
CommandLineParser.scala

Print error message explaining given ParserError

Print error message explaining given ParserError

Source
CommandLineParser.scala