Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bkirwi/decline
A composable command-line parser for Scala.
https://github.com/bkirwi/decline
Last synced: 2 months ago
JSON representation
A composable command-line parser for Scala.
- Host: GitHub
- URL: https://github.com/bkirwi/decline
- Owner: bkirwi
- License: apache-2.0
- Created: 2016-10-23T00:30:19.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-07-29T10:44:20.000Z (6 months ago)
- Last Synced: 2024-08-02T13:34:31.217Z (6 months ago)
- Language: Scala
- Homepage: http://monovore.com/decline/
- Size: 2.77 MB
- Stars: 641
- Watchers: 8
- Forks: 70
- Open Issues: 39
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-scala-native - decline - A composable command-line parser for Scala. (Console)
README
# decline
[![Build Status](https://img.shields.io/github/actions/workflow/status/bkirwi/decline/ci.yml?branch=main)](https://github.com/bkirwi/decline/actions)
[![Discord](https://img.shields.io/discord/632277896739946517.svg?label=&logo=discord&logoColor=ffffff&color=404244&labelColor=6A7EC2)](https://discord.com/channels/632277896739946517/895394320100761731)A composable command-line parser, inspired by [`optparse-applicative`][optparse]
and built on [`cats`][cats].```scala
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](http://monovore.com/decline/)!**
## About the Project
`decline` is a [Typelevel](https://typelevel.org/projects/) project,
and follows the [Typelevel Scala Code of Conduct](https://typelevel.org/code-of-conduct).This project is released under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).
[optparse]: https://github.com/pcapriotti/optparse-applicative
[cats]: https://github.com/typelevel/cats
[decline]: http://ben.kirw.in/decline/