bkirwi / decline   2.4.1

Apache License 2.0 Website GitHub

A composable command-line parser for Scala.

Scala versions: 3.x 2.13 2.12 2.11
Scala.js versions: 1.x 0.6
Scala Native versions: 0.4


Build Status Discord

A composable command-line parser, inspired by optparse-applicative and built on cats.

import cats.implicits._
import com.monovore.decline._

object HelloWorld extends CommandApp(
  name = "hello-world",
  header = "Says hello!",
  main = {
    val userOpt =
      Opts.option[String]("target", help = "Person to greet.")

    val quietOpt = Opts.flag("quiet", help = "Whether to be quiet.").orFalse

    (userOpt, quietOpt).mapN { (user, quiet) => 

      if (quiet) println("...")
      else println(s"Hello $user!")

To get started, please visit monovore.com/decline!

About the Project

decline is a Typelevel project, and follows the Scala Code of Conduct.

This project is released under the Apache License 2.0.