Typesafe activator available command line options/features

Alex picture Alex · Oct 8, 2015 · Viewed 7k times · Source

Is there a way to find out all the possible activator command line options?

The activator -help only provides a bare minimum available option/feature list but all the nice things are hidden and not available even on the typesafe website online documentation.

So far I know of the following commands/features:

activator run
activator -jvm-debug 9999 run
activator compile
activator clean
activator clean compile dist
activator doc //creates a nice documentation of your whole project

Any idea where this is information is available?

('m using activator to run Play framework projects)

Answer

Andriy Kuba picture Andriy Kuba · Oct 16, 2015

Activator is not some tool that have some wide options. It looks like, but it is just a wrapper to run sbt project. From the activator source page in git:

Activator aims to be a friendly one-stop-shop to bootstrap your Scala, Akka, and Play development. It can be used as a wrapper script that launches into traditional command line sbt, but it also includes a template and tutorial system, and an optional GUI for getting started.

You can think of Activator as traditional sbt (activator shell or activator ), plus an optional UI mode (activator ui), plus a template system (activator new).

That's all. Actually only four commands:

  • ui - to run ui mode
  • new - to create new project from the template
  • list-templates - to show all available templates
  • shell - to run sbt shell

Let's look in to this in a details.

The source code

https://github.com/typesafehub/activator/blob/master/launcher/src/main/scala/activator/ActivatorLauncher.scala

try configuration.arguments match {
  case Array("ui") => RebootToUI(configuration, version = checkForUpdatedVersion.getOrElse(APP_VERSION))
  case Array("new", _*) => Exit(ActivatorCli(configuration))
  case Array("list-templates") => Exit(TemplateHandler())
  case Array("shell") => RebootToSbt(configuration, useArguments = false)
  case _ if Sbt.looksLikeAProject(new File(".")) => RebootToSbt(configuration, useArguments = true)
  case _ => displayHelp(configuration)
} catch {
  case e: Exception => generateErrorReport(e)
}

You can see that there is only 4 commands ui, new, list-template, shell and one meta command:

case _ if Sbt.looksLikeAProject(new File(".")) => RebootToSbt(configuration, useArguments = true)

It means that if you run activator command in the project directory (and it's not ui, new, list-template, shell) than activator will run sbt with the command and argument that you pass to the activator. So run, compile, stage is not activator commands but sbt commands.

If you will run activator not in the project directory (and it's not ui, new, list-template, shell commands), then it will show you some "help page"

Activator also allow to pass java arguments that would be used for run activator.jar - you can see it by inspecting "activator.bat" file or activator shell script.

SBT

Reference of sbt commands you can found here: http://www.scala-sbt.org/0.13/docs/Command-Line-Reference.html