From 2425a23e4736cccaa7ab5ceac202984d1c8e4ad5 Mon Sep 17 00:00:00 2001 From: Chris Tessmer Date: Fri, 1 May 2026 17:54:05 -0400 Subject: [PATCH 1/2] Fix `bolt guide` crash when using rainbow formatter Signed-off-by: Chris Tessmer --- lib/bolt/outputter/rainbow.rb | 6 +++++- spec/unit/outputter/rainbow_spec.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bolt/outputter/rainbow.rb b/lib/bolt/outputter/rainbow.rb index f1d4915e8..904458b38 100644 --- a/lib/bolt/outputter/rainbow.rb +++ b/lib/bolt/outputter/rainbow.rb @@ -104,7 +104,11 @@ def print_guide(guide, _topic) @stream.puts colorize(:rainbow, guide) end - def print_topics(topics) + # Print available guide topics. + # + # @param topics [Array] The available topics. + # + def print_topics(topics:, **_kwargs) content = String.new("Available topics are:\n") content += topics.join("\n") content += "\n\nUse `bolt guide ` to view a specific guide." diff --git a/spec/unit/outputter/rainbow_spec.rb b/spec/unit/outputter/rainbow_spec.rb index e43539587..f8e6c6947 100644 --- a/spec/unit/outputter/rainbow_spec.rb +++ b/spec/unit/outputter/rainbow_spec.rb @@ -65,7 +65,7 @@ CONTENT expect(outputter).to receive(:colorize).with(:rainbow, content) - outputter.print_topics(%w[foo bar]) + outputter.print_topics(topics: %w[foo bar]) end it "colorizes a message" do From 11ea72b527ba6fc89a7299b9f71ff1656d111acd Mon Sep 17 00:00:00 2001 From: Chris Tessmer Date: Tue, 5 May 2026 22:00:02 -0400 Subject: [PATCH 2/2] Standardize outputters' `print_topics` signatures Ever since commit 759f54c, the method signatures for the various format outputters (`json`, `human`, `rainbow`) have been inconsistent. This patch removes unused/unneccessary `**kwargs`, standardizes arguments as `(topics: []`), and updates method documentation to reflect their actual behavior. Signed-off-by: Chris Tessmer --- lib/bolt/application.rb | 6 ++---- lib/bolt/outputter/human.rb | 2 +- lib/bolt/outputter/json.rb | 4 ++-- lib/bolt/outputter/rainbow.rb | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/bolt/application.rb b/lib/bolt/application.rb index 2021a3cf2..672389249 100644 --- a/lib/bolt/application.rb +++ b/lib/bolt/application.rb @@ -148,10 +148,8 @@ def list_groups # Show available guides. # - # @param guides [Hash] A map of topics to paths to guides. - # @param outputter [Bolt::Outputter] An outputter instance. - # @return [Boolean] - # + # @return [Hash] A map of topics of guides + # Currently, the map is structured as `:topics => [Array] of guide names` def list_guides { topics: load_guides.keys } end diff --git a/lib/bolt/outputter/human.rb b/lib/bolt/outputter/human.rb index 54a6b1419..5df91fa4c 100644 --- a/lib/bolt/outputter/human.rb +++ b/lib/bolt/outputter/human.rb @@ -486,7 +486,7 @@ def print_plans(plans:, modulepath:) # # @param topics [Array] The available topics. # - def print_topics(topics:, **_kwargs) + def print_topics(topics:) info = +"#{colorize(:cyan, 'Topics')}\n" info << indent(2, topics.join("\n")) info << "\n\n#{colorize(:cyan, 'Additional information')}\n" diff --git a/lib/bolt/outputter/json.rb b/lib/bolt/outputter/json.rb index ba7a4c610..de5b06e49 100644 --- a/lib/bolt/outputter/json.rb +++ b/lib/bolt/outputter/json.rb @@ -122,8 +122,8 @@ def print_result_set(result_set) # # @param topics [Array] The available topics. # - def print_topics(**kwargs) - print_table(kwargs) + def print_topics(topics:) + print_table({ topics: topics }) end # Print the guide for the specified topic. diff --git a/lib/bolt/outputter/rainbow.rb b/lib/bolt/outputter/rainbow.rb index 904458b38..9a0cbf091 100644 --- a/lib/bolt/outputter/rainbow.rb +++ b/lib/bolt/outputter/rainbow.rb @@ -108,7 +108,7 @@ def print_guide(guide, _topic) # # @param topics [Array] The available topics. # - def print_topics(topics:, **_kwargs) + def print_topics(topics:) content = String.new("Available topics are:\n") content += topics.join("\n") content += "\n\nUse `bolt guide ` to view a specific guide."