Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play Framework prompt override #10

Closed
thisismana opened this issue Jul 19, 2016 · 3 comments
Closed

Play Framework prompt override #10

thisismana opened this issue Jul 19, 2016 · 3 comments

Comments

@thisismana
Copy link

I'm having troubles enabling your plugin in a play project. In our library project, it works as described. But for the play project, I always get the default prompt.

plugin.sbt

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.4")

addSbtPlugin("com.scalapenos" % "sbt-prompt" % "1.0.0")

build.sbt

lazy val root = (project in file("."))
  .enablePlugins(PlayScala)
  .settings(promptTheme := ScalapenosTheme)

I tried moving the promptTheme to the root level of the sbt file, but no effect. Am I missing something? The prompt stays at play's? default [helloWorld] $.

I also tried to register it as a global sbt plugin.

@agemooij
Copy link
Owner

Unfortunately both plugins try to set the same SBT setting and obviously the Play one wins, probably due to fact that SBT loads the Play plugin after it loads the sbt-prompt plugin.

I don't think I can do much to fix this in the plugin itself. This is not something that is easily worked around from the plugin level since the order in which the plugin is loaded relative to other plugins that it doesn't depend upon is undetermined AFAIK.

A project-level workaround could be to enable both plugins and then manually set the shell prompt to the one from the sbt-prompt plugin.

Could you try the following line in your project definition?:

shellPrompt := (state  promptTheme.value.render(state))

You might need to add the following import:

import com.scalapenos.sbt.prompt.SbtPrompt.autoImport._

This is straight from the sbt-prompt plugin. My theory is that repeating it in the project itself makes sure that you overwrite the prompt set by the Play plugin.

Let me know wether this works.

@orendain
Copy link

Just a headsup that:
shellPrompt := (state ⇒ promptTheme.value.render(state))
worked fine. SbtPrompt displayed over Play's.

@agemooij
Copy link
Owner

Thanks for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants