0

Using ammonite 0.7.0 using cd! in scripts would change you to that directory and execute the following bit of code, which was great as i've been using ammonite for build & deploy of a scala project.

But in 0.7.8 this does not work any longer, it fails like...

cat TestCd.sc

import ammonite.ops._
import ammonite.ops.ImplicitWd._
cd! root/'Users/'jeff

Error:

TestCd.sc:4: not found: value cd
val res_2 = cd! root/'Users/'jeff

I can make it work in this (very) small test by changing the code to import and instantiate a ammonite.shell.ShellSession, but that leads to other issues.

I've asked on gitter and in github issues, thought i'd cast a wider net as i've not received responses.

Thanks in advance, i don't want to stay on an old version or rewrite the deployment script in a more mature scripting language, as I'm using scala for other things, and feel this is critical to writing shell scripts in any language.

Jeff

ekydfejj
  • 339
  • 2
  • 14

1 Answers1

0

While it would be nice if this just worked. An item I missed is that you can install a custom ~/.ammonite/predefScript.sc, and this is how i've gotten around the issue. The contents is identical to predef.sc without the final line. Feel free to grab it from this gist if you need this as well.

predefScript.sc - Gist

Add it to your system with mkdir -p ~/.ammonite && curl -L -o ~/.ammonite/predefScript.sc https://git.io/v1vv7

ekydfejj
  • 339
  • 2
  • 14