From 5deaf2956fbd262e37f7af57ef9f4db8a6251cb9 Mon Sep 17 00:00:00 2001 From: Brad Gessler Date: Sat, 17 Aug 2024 14:04:54 -0700 Subject: [PATCH] Return subcommand if its already registered --- lib/thor.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/thor.rb b/lib/thor.rb index cf999e6e..d20f332a 100644 --- a/lib/thor.rb +++ b/lib/thor.rb @@ -327,6 +327,8 @@ def subcommand_classes end def subcommand(subcommand, subcommand_class) + return subcommand_classes[subcommand.to_s] if subcommands.include? subcommand.to_s + subcommands << subcommand.to_s subcommand_class.subcommand_help subcommand subcommand_classes[subcommand.to_s] = subcommand_class