Skip to content

Commit

Permalink
Return subcommand if its already registered
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgessler committed Aug 17, 2024
1 parent a43d92f commit 5deaf29
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/thor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5deaf29

Please sign in to comment.