Skip to content

Commit

Permalink
irb: save repl history
Browse files Browse the repository at this point in the history
This enables history for `brew irb` sessions.
It saves that history to the repository directory.
  • Loading branch information
apainintheneck committed Mar 5, 2023
1 parent 6a953d1 commit ba104f7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -194,6 +194,7 @@
!/.dockerignore
!/.editorconfig
!/.gitignore
!/.irb_config
!/.yardopts
!/.vale.ini
!/.shellcheckrc
Expand Down
11 changes: 11 additions & 0 deletions .irb_config
@@ -0,0 +1,11 @@
# Not that we use a non-standard config file name to reduce
# name clashes with other IRB config files like `.irbrc`.

require 'irb/completion'

irb_history = (HOMEBREW_REPOSITORY/".irb_history")

FileUtils.touch(irb_history)

IRB.conf[:HISTORY_FILE] = irb_history.to_s
IRB.conf[:SAVE_HISTORY] = 100
2 changes: 2 additions & 0 deletions Library/Homebrew/dev-cmd/irb.rb
Expand Up @@ -67,6 +67,8 @@ def irb
if args.pry?
Pry.start
else
ENV["IRBRC"] = (HOMEBREW_REPOSITORY/".irb_config").to_s

IRB.start
end
end
Expand Down

0 comments on commit ba104f7

Please sign in to comment.