Change history and config file dirs

Now both REPL history is written to $HOME.
- Pry: $HOME/.brew_pry_history
- IRB: $HOME/.brew_irb_history

The IRB config file has also been moved to the
library directory.
This commit is contained in:
apainintheneck 2023-03-07 19:04:19 -08:00
parent 9f7ab25af5
commit deabd4a5f9
3 changed files with 11 additions and 10 deletions

View File

@ -1,8 +0,0 @@
# Note that we use a non-standard config file name to reduce
# name clashes with other IRB config files like `.irbrc`.
require 'irb/completion'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{__dir__}/.irb_history"
IRB.conf[:IRB_NAME] = "brew"

View File

@ -0,0 +1,9 @@
# Note: that we use a non-standard config file name to reduce
# name clashes with other IRB config files like `.irbrc`.
# Note #2: This doesn't work with system Ruby for some reason.
require 'irb/completion'
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{Dir.home}/.brew_irb_history"
IRB.conf[:IRB_NAME] = "brew"

View File

@ -65,13 +65,13 @@ module Homebrew
ohai "Interactive Homebrew Shell", "Example commands available with: `brew irb --examples`"
if args.pry?
Pry.config.should_load_rc = false # skip loading .pryrc
Pry.config.history_file = (HOMEBREW_REPOSITORY/".pry_history").to_s
Pry.config.history_file = "#{Dir.home}/.brew_pry_history"
Pry.config.memory_size = 100 # max lines to save to history file
Pry.config.prompt_name = "brew"
Pry.start
else
ENV["IRBRC"] = (HOMEBREW_REPOSITORY/".irb_config").to_s
ENV["IRBRC"] = (HOMEBREW_LIBRARY_PATH/"brew_irbrc").to_s
IRB.start
end