smenu

Simple menus for Scala console applications

License

License

MIT
GroupId

GroupId

com.github.kovszilard
ArtifactId

ArtifactId

smenu_2.12
Last Version

Last Version

0.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

smenu
Simple menus for Scala console applications
Project URL

Project URL

https://github.com/kovszilard/smenu
Project Organization

Project Organization

kovszilard
Source Code Management

Source Code Management

https://github.com/kovszilard/smenu

Download smenu_2.12

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.10
org.typelevel : cats-core_2.12 jar 2.1.0
org.typelevel : cats-effect_2.12 jar 2.1.1
org.jline : jline jar 3.13.3

test (1)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.1.0

Project Modules

There are no modules declared in this project.

Smenu

Build Status Maven central Tweet Twitter follow

Simple menus for Scala console applications

Screenshot

Features

  • Functional API
  • Menu is displayed using Show instance of menu elements. (You are not restricted to use String elements only.)
  • Pluggable effect type, based on cats-effect

Usage

Include it in your project by adding the following to your build.sbt:

libraryDependencies += "com.github.kovszilard" %% "smenu" % "0.1.0"

Singe choice menu

// Using IO for effect, and String for menu elements
import cats.Show
import cats.instances.all._
import cats.syntax.all._
import cats.data.NonEmptyList
import cats.effect.IO
import smenu.Menu._

singleChoiceMenu[IO, String]("What is your favourite fruit?", NonEmptyList.of("Apple", "Banana", "Orange"))

Multiple choice menu

// Using IO for effect, and Pet for menu elements
import cats.Show
import cats.instances.all._
import cats.syntax.all._
import cats.data.NonEmptyList
import cats.effect.IO
import smenu.Menu._

trait Pet
case object Cat extends Pet
case object Dog extends Pet

implicit def showPet: Show[Pet] = Show[String].contramap(_.toString)

multipleChoiceMenu[IO, Pet]("Cats or dogs or both?", NonEmptyList.of(Cat, Dog))

Do you like this project? ❤️

Please give it a star. It is just one click for you and it keeps me motivated to write open source tools like this.

Versions

Version
0.1.2
0.1.0