Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.65 KB

README.md

File metadata and controls

46 lines (31 loc) · 1.65 KB

REPL Helper Build Status Codacy Badge codecov.io

What is it?

Small library allowing to provide annotation based help text for functions in the Scala REPL. Easily implement a help method in your REPL application by writing help texts into method annotations.

Get It!

In order to use the REPL helper, you can add it as a dependency to your project using JitPack.io. Just add it to your build.sbt like this:

resolvers += "jitpack" at "https://jitpack.io"

libraryDependencies += "com.github.FRosner" % "repl-helper" % "x.y.z"

Use It!

  1. Define the @Help annotation on your methods.

    object MyReplUtil {
    
      @Help(
        category = "Math",
        shortDescription = "Add two numbers",
        longDescription = "Add two numbers. Integer overflow might occur!",
        parameters = "a: Int, b: Int"
      )
      def add(a: Int, b: Int) = a + b
    
    }
  2. Create a helper instance of your class.

    val myHelper = Helper(MyReplUtil.getClass)
  3. Print help to a PrintStream of your choice. You can either print all available methods or request detailed help for a particular one.

    myHelper.printAllMethods(System.out)
    myHelper.printMethods("add", System.out)