irb: enable global options
The --debug and --quiet options weren't working before with the REPL because IRB didn't recognize them.
This commit is contained in:
parent
180c89e174
commit
11a0ea1833
@ -39,6 +39,8 @@ module Homebrew
|
||||
# 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
|
||||
@ -68,4 +70,13 @@ module Homebrew
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user