From aef9cd665651f52a329b7587dab68b1c000e6f0a Mon Sep 17 00:00:00 2001 From: JoelTowell Date: Sat, 30 May 2026 15:40:55 +1000 Subject: [PATCH 1/2] Disable required check for tree and skip check_at_least_one! if disable_required_check --- lib/thor.rb | 2 +- lib/thor/parser/options.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/thor.rb b/lib/thor.rb index 8648505a..adf2a5d9 100644 --- a/lib/thor.rb +++ b/lib/thor.rb @@ -476,7 +476,7 @@ def stop_on_unknown_option #:nodoc: # help command has the required check disabled by default. def disable_required_check #:nodoc: - @disable_required_check ||= [:help] + @disable_required_check ||= [:help, :tree] end def print_exclusive_options(shell, command = nil) # :nodoc: diff --git a/lib/thor/parser/options.rb b/lib/thor/parser/options.rb index 17d0cee5..8e4e84c9 100644 --- a/lib/thor/parser/options.rb +++ b/lib/thor/parser/options.rb @@ -134,7 +134,7 @@ def parse(args) # rubocop:disable Metrics/MethodLength check_requirement! unless @disable_required_check check_exclusive! - check_at_least_one! + check_at_least_one! unless @disable_required_check assigns = Thor::CoreExt::HashWithIndifferentAccess.new(@assigns) assigns.freeze From 7f3bf7071de86079b5cd9170d2e5f0f651acba9b Mon Sep 17 00:00:00 2001 From: JoelTowell Date: Sat, 30 May 2026 16:06:10 +1000 Subject: [PATCH 2/2] Update disable_required_check comment --- lib/thor.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/thor.rb b/lib/thor.rb index adf2a5d9..1d8e293c 100644 --- a/lib/thor.rb +++ b/lib/thor.rb @@ -474,7 +474,7 @@ def stop_on_unknown_option #:nodoc: @stop_on_unknown_option ||= [] end - # help command has the required check disabled by default. + # help and tree commands have the required check disabled by default. def disable_required_check #:nodoc: @disable_required_check ||= [:help, :tree] end