decline

Composable command-line parsing for Scala

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.monovore
ArtifactId

ArtifactId

decline_2.11
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

decline
Composable command-line parsing for Scala
Project URL

Project URL

http://monovore.com/decline
Project Organization

Project Organization

com.monovore
Source Code Management

Source Code Management

https://github.com/bkirwi/decline

Download decline_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.monovore/decline_2.11/ -->
<dependency>
    <groupId>com.monovore</groupId>
    <artifactId>decline_2.11</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.monovore/decline_2.11/
implementation 'com.monovore:decline_2.11:1.2.0'
// https://jarcasting.com/artifacts/com.monovore/decline_2.11/
implementation ("com.monovore:decline_2.11:1.2.0")
'com.monovore:decline_2.11:jar:1.2.0'
<dependency org="com.monovore" name="decline_2.11" rev="1.2.0">
  <artifact name="decline_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.monovore', module='decline_2.11', version='1.2.0')
)
libraryDependencies += "com.monovore" % "decline_2.11" % "1.2.0"
[com.monovore/decline_2.11 "1.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
org.typelevel : cats-core_2.11 jar 2.0.0

test (2)

Group / Artifact Type Version
org.typelevel : cats-laws_2.11 jar 2.0.0
org.typelevel : discipline-scalatest_2.11 jar 1.0.0-RC4

Project Modules

There are no modules declared in this project.

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.

Versions

Version
1.2.0
1.0.0
0.7.0-M0
0.6.2
0.6.1
0.6.0
0.5.1
0.5.0
0.4.2
0.4.1
0.4.0
0.4.0-RC2
0.4.0-RC1
0.4.0-M2
0.3.0