irb: save repl history

This enables history for `brew irb` sessions.
It saves that history to the repository directory.
This commit is contained in:
apainintheneck 2023-03-04 21:18:15 -08:00
parent 11a0ea1833
commit 6ab6d7c8ee
3 changed files with 11 additions and 0 deletions

1
.gitignore vendored
View File

@ -194,6 +194,7 @@
!/.dockerignore !/.dockerignore
!/.editorconfig !/.editorconfig
!/.gitignore !/.gitignore
!/.irb_config
!/.yardopts !/.yardopts
!/.vale.ini !/.vale.ini
!/.shellcheckrc !/.shellcheckrc

8
.irb_config Normal file
View File

@ -0,0 +1,8 @@
# 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

@ -67,6 +67,8 @@ module Homebrew
if args.pry? if args.pry?
Pry.start Pry.start
else else
ENV["IRBRC"] = (HOMEBREW_REPOSITORY/".irb_config").to_s
IRB.start IRB.start
end end
end end