Created
December 20, 2017 21:52
-
-
Save fehu/ef41de0bde61fd9157e340f6f5a8a7e9 to your computer and use it in GitHub Desktop.
ammonite predef
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interp.load.ivy( | |
"com.lihaoyi" % | |
s"ammonite-shell_${scala.util.Properties.versionNumberString}" % | |
ammonite.Constants.version | |
) | |
@ | |
val shellSession = ammonite.shell.ShellSession() | |
import shellSession._ | |
import ammonite.ops._ | |
import ammonite.shell._ | |
ammonite.shell.Configure(interp, repl, wd) | |
implicit class PromtExt(promt: ammonite.repl.FullReplAPI) { | |
def promtShort(): Unit = repl.prompt() = "> " | |
def promtFull(): Unit = repl.prompt.bind(prefix + ":" + shortWd + "> ") | |
private def shortWd = | |
if (wd startsWith home) "~/" + wd.relativeTo(home).toString | |
else wd.toString | |
private lazy val prefix = | |
sys.props("user.name") + PromtExt.org.map("@" + _).getOrElse("") | |
} | |
object PromtExt { | |
protected val org = None | |
} | |
repl.promtFull() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment