-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Arguments.scala
28 lines (24 loc) · 849 Bytes
/
Arguments.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.leobenkel.example1
import com.leobenkel.zparkio.Services.CommandLineArguments
import com.leobenkel.zparkio.Services.CommandLineArguments.CommandLineArguments
import com.leobenkel.zparkio.config.scallop.CommandLineArgumentScallop
import org.rogach.scallop.{ScallopConf, ScallopOption}
import zio.ZIO
case class Arguments(input: List[String])
extends ScallopConf(input) with CommandLineArgumentScallop.Service[Arguments] {
val inputId: ScallopOption[Int] = opt[Int](
default = Some(10),
required = false,
noshort = true
)
val sparkFoo: ScallopOption[String] = opt[String](
default = Some("hello"),
required = false,
noshort = true
)
}
object Arguments {
def apply[A](f: Arguments => A): ZIO[CommandLineArguments[Arguments], Throwable, A] = {
CommandLineArguments.get[Arguments].apply(f)
}
}