hnaderi / scala-readpass   0.1.0

Apache License 2.0 GitHub

Cross platform readpassword for scala native and jvm

Scala versions: 3.x 2.13
Scala Native versions: 0.5 0.4

readpassword

readpassword Scala version support Build GitHub

This is a cross platform readpassword utility useful for CLIs that require reading password from stdin. It acts like standard unix style of password input, like in sudo where password is hidden on input.

Usage

This library is currently available for Scala binary versions 2.13 and 3.2 on JVM and Scala native.

To use the latest version, include the following in your build.sbt:

libraryDependencies ++= Seq(
  "dev.hnaderi" %%% "readpassword" % "<see badge>"
)

Then use it like:

import dev.hnaderi.readpassword

object Main extends App {
  val pass = readpassword.read("Enter your password: ")
  println(s"Your password is: $pass")
}

And then:

sbt:root> exampleNative/run
Enter your password: 
Your password is: This is my password!

Supports

env native jvm
linux
macos
posix compliant OSes
windows