-
Notifications
You must be signed in to change notification settings - Fork 707
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
REPL Autoload file #1009
REPL Autoload file #1009
Conversation
I guess it does sound nice to have it walk up to at least the user home directory so that each project can have its own custom imports. :/ Any way to test this? |
Other things that might go in this PR/config:
|
I think I can add another repl test to the script we already have. I'll give it a try. |
Now the REPL will automatically load files named ".scalding_repl" in your path. The prompt can also now be customized (presumably from in a .scalding_repl file, but can be done manually as well). Ready for anyone who's interested to review this. |
* up to root. | ||
*/ | ||
private def findAllUpPath(filename: String): List[File] = | ||
Iterator.iterate(System.getProperty("user.dir"))(new File(_).getParent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you say current directory here, but you are actually getting the user's home dir.
I like the idea of a current directory so I could put some .scalding_repl file in my science directory have that different from my home. Am I missing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this property is named kind of confusingly named: "user.dir" is the current working directory (of the user, I guess...)
scala> System.getProperty("user.dir")
res0: java.lang.String = /Users/bholt/dev/hub/scalding
scala> System.getProperty("user.home")
res1: java.lang.String = /Users/bholt
Thanks for clearing me up there! :) |
also, can you add a quick note in the REPL wiki page about how to use this feature? |
Roger, Rodger. |
This PR enables users to specify commands that will automatically be executed when the REPL loads (such as including time zone, sources, etc).
So far, I have the repl loading a single file in the user's home directory (~/.scalding_repl).
Is there any value in trying to make it search other places for files, such as walking up to the root from the current directory (as many other configs do). This doesn't seem particularly useful for the way most people run from the root of the project.