https://github.com/andimiller/effectful-decline
https://github.com/andimiller/effectful-decline
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/andimiller/effectful-decline
- Owner: andimiller
- License: mit
- Created: 2019-03-26T18:36:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-10T10:59:40.000Z (about 6 years ago)
- Last Synced: 2025-01-18T20:59:07.526Z (4 months ago)
- Language: Scala
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# effectful-decline
This library connects `cats-effect` and `decline` to give you a nice way to define something that's both an `IOApp` and a `CommandApp`, also I didn't really like `CommandApp` much.
## Example
```scala
import cats._, cats.implicits._
import cats.effect._
import com.monovore.decline._case class Config(a: Boolean, o: Option[String], arg: String)
object Example extends IOCommandApp[Config] {
val name: String = "example"
val header: String = "an example program"
override val version: String = "0.1.0"override def commandLine = (
Opts.flag("a", "an a flag").orFalse,
Opts.option[String]("o", "an o option").orNone,
Opts.argument[String]("an argument")
).mapN(Config.apply)override def main(c: Config): IO[ExitCode] = IO {
println((c.a, c.o, c.arg))
ExitCode.Success
}
}
```