save-file's filename argument should be optional #735

kyrylo opened this Issue Oct 26, 2012 · 2 comments


None yet

2 participants

kyrylo commented Oct 26, 2012

For example, I can't be bothered to type a name of the file when I use save-file command. I want Pry to handle that for me (only if I haven't provided filename as an argument).

[2] pry(main)> def foobar
[2] pry(main)*   :foobar
[2] pry(main)* end  
=> nil
[3] pry(main)> save-file -m foobar
[4] pry(main)> .ls
foobar_method.rb blahblah/
[5] pry(main)> def piyo
[5] pry(main)*   :piyo
[5] pry(main)* end  
=> nil
[6] pry(main)> save-file -m foobar -m piyo
[7] pry(main)> .ls
foo.rb pry_export.rb blahblah/

I think, Pry should choose "intelligent" names (appropriate names for each case, because it can save not only methods :P).

save-file should store files somewhere in ~/pry directory by default. It should be configurable, though. A user should be able to use something like Pry.config.save_file_path to set their custom path.


This looks pretty good. The $stdin.gets is a bit worrying, but I guess people using pry-remote won't use save-file anyway.

It would seem saner to default Pry.config.save_file_path to the current directory, which would then avoid that problem in the common case (and is probably more "expected"). What do you think?

(/cc @kyrylo)

kyrylo commented Nov 11, 2012

Sorry, my fault here. I made a typo in the default save-file path. I meant to write ~/.pry instead of ~/pry. Maybe even ~/.pry/saved_files.

On the other hand, I forgot to mention that in the issue, it could be the current directory as @ConradIrwin said.

I'm not sure, which way I prefer more. Both of them have benefits. @robgleeson, what do you think? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment