Skip to content

Commit ee64166

Browse files
committed
extract DynamicCommand into separate method so it's easier to override and provide your own command class.
1 parent 2b347d4 commit ee64166

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/thor.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def dispatch(meth, given_args, given_opts, config) #:nodoc:
350350
end
351351
else
352352
args, opts = given_args, nil
353-
command = Thor::DynamicCommand.new(meth)
353+
command = dynamic_command_class.new(meth)
354354
end
355355

356356
opts = given_opts || opts || []
@@ -376,6 +376,10 @@ def baseclass #:nodoc:
376376
Thor
377377
end
378378

379+
def dynamic_command_class #:nodoc:
380+
Thor::DynamicCommand
381+
end
382+
379383
def create_command(meth) #:nodoc:
380384
if @usage && @desc
381385
base_class = @hide ? Thor::HiddenCommand : Thor::Command

0 commit comments

Comments
 (0)