UnitFlag

works.scala.cmd.UnitFlag
trait UnitFlag extends Flag[Unit]

A helper trait that defaults parseArgument to a Unit value.

Attributes

Source:
Flag.scala
Graph
Supertypes
trait Flag[Unit]
class Object
trait Matchable
class Any
Known subtypes
object HelpFlag.type

Members list

Concise view

Value members

Concrete methods

override def parseArgument: PartialFunction[String, Unit]

A partial function that will take the String value of the passed argument, and convert it to type F.

A partial function that will take the String value of the passed argument, and convert it to type F.

Typical usage might be for parsing String to Int/Float/Custom Domain, e.g. for a Flag[Int], parse = str => str.toInt.

Advanced usage could be used to do more targeted work as well, such as processing the argument directly, versus simply obtaining the value for it to be parsed later, e.g. for a Flag[String], parse = str => str.toUpperCase

Attributes

Returns:

the evaluation of String => F

Definition Classes
Source:
Flag.scala

Inherited methods

final def isPresent(args: List[String]): Boolean

Checks if flags to trigger this Flag are present in the provided Command arguments

Checks if flags to trigger this Flag are present in the provided Command arguments

Attributes

args

The arguments passed to the command

Returns:

true if present, otherwise false

Inherited from:
Flag
Source:
Flag.scala
final def parseFirstFlagArg(args: List[String]): Option[F]

A method that will find the first instance of an argument triggering this Flag, if present, and evaluate the parseArgument partial function on it.

A method that will find the first instance of an argument triggering this Flag, if present, and evaluate the parseArgument partial function on it.

Most useful when this Flag is expected once.

Attributes

args

The arguments passed to the command

See also:
Inherited from:
Flag
Source:
Flag.scala
final def parseFlagArgs(args: List[String]): Seq[F]

Finds instances of arguments that trigger this Flag, and processes them through parseArgument

Finds instances of arguments that trigger this Flag, and processes them through parseArgument

Attributes

args

The arguments passed to the command

Inherited from:
Flag
Source:
Flag.scala
final def stripArgs(args: List[String]): List[String]

A method to remove the flag trigger, and any arguments, from the input args, so that positional Args can then be processed

A method to remove the flag trigger, and any arguments, from the input args, so that positional Args can then be processed

Attributes

Inherited from:
Flag
Source:
Flag.scala

Inherited fields

val description: String

A description of the purpose of this flag, used in documentation.

A description of the purpose of this flag, used in documentation.

Attributes

Inherited from:
Flag
Source:
Flag.scala
val hasArgument: Boolean

Indicates this Flag expects an argument. Defaults to true.

Indicates this Flag expects an argument. Defaults to true.

Attributes

Inherited from:
Flag
Source:
Flag.scala
val name: String

The name of the flag, e.g. "help". This will be parsed as s"--$name", e.g. "--help"

The name of the flag, e.g. "help". This will be parsed as s"--$name", e.g. "--help"

Attributes

Inherited from:
Flag
Source:
Flag.scala
val shortKey: String

A short-key version of name, e.g. "h". This will be parsed as s"-$shortKey", e.g. "-h"

A short-key version of name, e.g. "h". This will be parsed as s"-$shortKey", e.g. "-h"

Attributes

Inherited from:
Flag
Source:
Flag.scala