From 746423169ec37d287877ee21174f321b489bf937 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..1b9916a6 100644 --- a/lib/thor.rb +++ b/lib/thor.rb @@ -327,6 +327,8 @@ def subcommand_classes end def subcommand(subcommand, subcommand_class) + return self.class.subcommand_classes[command] if subcommands.include? subcommand.to_s + subcommands << subcommand.to_s subcommand_class.subcommand_help subcommand subcommand_classes[subcommand.to_s] = subcommand_class