Skip to content

Small library allowing to provide annotation based help text for functions in the Scala REPL

License

Notifications You must be signed in to change notification settings

RPCMoritz/repl-helper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Small library allowing to provide annotation based help text for functions in the Scala REPL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 79.3%
  • Java 20.7%