Skip to content

bkirwi/decline

Folders and files

NameName
Last commit message
Last commit date
Feb 17, 2025
Jun 20, 2024
Mar 1, 2025
Jun 20, 2024
May 5, 2022
Mar 17, 2025
Jul 8, 2021
May 4, 2022
May 11, 2022
Jan 25, 2020
Feb 22, 2018
Feb 14, 2025
Feb 17, 2025
Jan 5, 2025

Repository files navigation

decline

Build Status Discord Typelevel library decline Scala version support

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

import cats.syntax.all._
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 project, and follows the Typelevel Scala Code of Conduct.

This project is released under the Apache License 2.0.