Skip to content

Commit

Permalink
irb: enable global options
Browse files Browse the repository at this point in the history
The --debug and --quiet options weren't working before
with the REPL because IRB didn't recognize them.
  • Loading branch information
apainintheneck committed Mar 5, 2023
1 parent 180c89e commit 6a953d1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Library/Homebrew/dev-cmd/irb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def irb
# work around IRB modifying ARGV.
args = irb_args.parse(ARGV.dup.freeze)

clean_argv

if args.examples?
puts <<~EOS
'v8'.f # => instance of the v8 formula
Expand Down Expand Up @@ -68,4 +70,13 @@ def irb
IRB.start
end
end

# Remove the `--debug`, `--verbose` and `--quiet` options which cause problems
# for IRB and have already been parsed by the CLI::Parser.
def clean_argv
global_options = Homebrew::CLI::Parser
.global_options
.flat_map { |options| options[0..1] }
ARGV.reject! { |arg| global_options.include?(arg) }
end
end

0 comments on commit 6a953d1

Please sign in to comment.