Skip to content
A composable command-line parser for Scala.
Branch: master
Clone or download
Pull request Compare This branch is 4 commits behind bkirwi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bench/src/main/scala/com/monovore/decline/bench
core
doc/src/main/tut
effect
project
refined/src
.gitignore
.travis.yml
LICENSE.md
README.md
build.sbt
version.sbt

README.md

decline

Build Status

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.")
        .withDefault("world")

    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 Incubator project, and follows the Scala Code of Conduct.

This project is released under the Apache License 2.0.

You can’t perform that action at this time.