From 5f8f618dc8e16bfaeb840f08daa29714f1746309 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sun, 12 Apr 2026 11:59:24 +0100 Subject: [PATCH] Add --nobanner option to suppress startup banner Closes https://github.com/ruby/irb/issues/1196 --- lib/irb/init.rb | 2 ++ test/irb/test_init.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/irb/init.rb b/lib/irb/init.rb index 365f445da..f933f5cec 100644 --- a/lib/irb/init.rb +++ b/lib/irb/init.rb @@ -346,6 +346,8 @@ def IRB.parse_opts(argv: ::ARGV) opt = $1 || argv.shift prompt_mode = opt.upcase.tr("-", "_").intern @CONF[:PROMPT_MODE] = prompt_mode + when "--nobanner" + @CONF[:SHOW_BANNER] = false when "--noprompt" @CONF[:PROMPT_MODE] = :NULL when "--script" diff --git a/test/irb/test_init.rb b/test/irb/test_init.rb index 66e4dfb62..b68681e38 100644 --- a/test/irb/test_init.rb +++ b/test/irb/test_init.rb @@ -285,6 +285,11 @@ def test_option_tracer assert_equal(true, IRB.conf[:USE_TRACER]) end + def test_nobanner + IRB.setup(eval("__FILE__"), argv: %w[--nobanner]) + assert_equal(false, IRB.conf[:SHOW_BANNER]) + end + private def with_argv(argv)