com.audienceproject.util.cli

Arguments

class Arguments extends AnyRef

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Arguments
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Arguments()(implicit args: Array[String])

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val arguments: Map[String, Option[String]]

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def getOption(key: String): Option[String]

    Get the String value of an argument.

    Get the String value of an argument. This is useful when you need to process an argument passed as --aSetting someValue, Returns None if the key does not exist.

    Example:

    import com.audienceproject.cli.Arguments
    
    object Test {
    
        // args: Array("--aSetting", "someValue")
        def main(implicit args: Array[String]) {
            val arguments = new Arguments
            // Returns Option[String] = Some(someValue)
            arguments.getOption("aSetting")
        }
    
    }
    key

    The argument key

  14. def getOption(key: String, default: String): String

    Get the String value of an argument, or a user-provided String in case the argument does not exist.

    Get the String value of an argument, or a user-provided String in case the argument does not exist. This is useful when you need to process an argument passed as --aSetting someValue.

    Example:

    import com.audienceproject.cli.Arguments
    
    object Test {
    
        // args: Array("--aSetting", "someValue")
        def main(implicit args: Array[String]) {
            val arguments = new Arguments
            // Returns String = "backup"
            arguments.getOption("noSetting", "backup")
        }
    
    }
    key

    The argument key

  15. def getOptionArray(key: String, default: Seq[String]): Seq[String]

    Get a list of String for a single CLI argument, or a default user-provided list in case the argument does not exist.

    Get a list of String for a single CLI argument, or a default user-provided list in case the argument does not exist. Comma , is used as a separator character. This is useful when you need to process an arguments passed as --severalValues one,two,three,

    Example:

    import com.audienceproject.cli.Arguments
    
    object Test {
    
        // args: Array("--severalValues", "one,two,three")
        def main(implicit args: Array[String]) {
            val arguments = new Arguments
            // Returns Seq[String] = List(five, six)
            arguments.getOptionArray("noValues", Seq("five", "six"))
        }
    
    }
    key

    The argument key

  16. def getOptionArray(key: String): Option[Seq[String]]

    Get a list of String for a single CLI argument.

    Get a list of String for a single CLI argument. Comma , is used as a separator character. This is useful when you need to process an arguments passed as --severalValues one,two,three. Returns None if the key does not exist.

    Example:

    import com.audienceproject.cli.Arguments
    
    object Test {
    
        // args: Array("--severalValues", "one,two,three")
        def main(implicit args: Array[String]) {
            val arguments = new Arguments
            // Returns Option[Seq[String]] = Some(WrappedArray(one, two, three))
            arguments.getOptionArray("severalValues")
        }
    }
    key

    The argument key

  17. def getTypeOption[A](key: String)(implicit m: Manifest[A]): Option[A]

    Get the A value of an argument.

    Get the A value of an argument. This is useful when you need to process an argument which is one of:

    • String
    • Boolean
    • Int
    • Long
    • Float
    • Double

    An example of such argument list is --aString str --aBoolean true --anInt 201 --aLong 343 --aFloat 10.4 --aDouble 14.3

    Will return None if the key does not exist.

    Example:

    import com.audienceproject.cli.Arguments
    
    object Test {
    
        // args: Array("--aString", "str", "--aBoolean", "true", "--anInt", "201", "--aLong", "343", "--aFloat", "10.4", "--aDouble", "14.3")
        def main(implicit args: Array[String]) {
            val arguments = new Arguments
    
            // Returns Option[String] = Some("str")
            arguments.getTypeOption[String]("aString")
    
            // Returns Option[Boolean] = None
            arguments.getTypeOption[Boolean]("notBoolean")
    
            // Returns Boolean = Some(true)
            arguments.getTypeOption[Boolean]("aBoolean")
    
            // Returns Int = Some(201)
            arguments.getTypeOption[Int]("anInt")
    
            // Returns Long = Some(343)
            arguments.getTypeOption[Long]("aLong")
    
            // Returns Float = Some(10.4)
            arguments.getTypeOption[Float]("aFloat")
    
            // Returns Double = Some(14.3)
            arguments.getTypeOption[Double]("aDouble")
        }
    
    }
    key

    The argument key

    returns

  18. def getTypeOption[A](key: String, default: A): A

    Get the A value of an argument, or a user-provided A in case the argument does not exist.

    Get the A value of an argument, or a user-provided A in case the argument does not exist. This is useful when you need to process an argument which is one of:

    • String
    • Boolean
    • Int
    • Long
    • Float
    • Double

    An example of such argument list is --aString str --aBoolean true --anInt 201 --aLong 343 --aFloat 10.4 --aDouble 14.3.

    Example:

    import com.audienceproject.cli.Arguments
    
    object Test {
    
        // args: Array("--aString", "str", "--aBoolean", "true", "--anInt", "201", "--aLong", "343", "--aFloat", "10.4", "--aDouble", "14.3")
        def main(implicit args: Array[String]) {
            val arguments = new Arguments
    
            // Returns String = "str"
            arguments.getTypeOption[String]("aString", "a")
    
            // Returns Boolean = false
            arguments.getTypeOption[Boolean]("notBoolean", false)
    
            // Returns Boolean = true
            arguments.getTypeOption[Boolean]("aBoolean", false)
    
            // Returns Int = 201
            arguments.getTypeOption[Int]("anInt", 3)
    
            // Returns Long = 343
            arguments.getTypeOption[Long]("aLong", 678)
    
            // Returns Float = 10.4
            arguments.getTypeOption[Float]("aFloat", 134.43F)
    
            // Returns Double = 14.3
            arguments.getTypeOption[Double]("aDouble", 4523.53)
        }
    
    }
    key

    The argument key

  19. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. def isSet(key: String): Boolean

    Check if a flag is set.

    Check if a flag is set. This is useful when you need to process an argument passed as --turnItOn. Will return false if the flag is not present in the arguments list. Returns true otherwise.

    Example:

    import com.audienceproject.cli.Arguments
    
    object Test {
    
        // args: Array("--turnItOn")
        def main(implicit args: Array[String]) {
            val arguments = new Arguments
            // Returns Boolean = true
            arguments.isSet("turnItOn")
            // Returns Boolean = false
            arguments.isSet("turnItOff")
        }
    
    }
    key

    The argument key

  22. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  26. final def toPairs(base: Map[String, Option[String]], iterator: BufferedIterator[String]): Map[String, Option[String]]

    Annotations
    @tailrec()
  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped