Module: RosettAi::SmartFeedback::ThorMiddleware::CommandDispatch

Defined in:
lib/rosett_ai/smart_feedback/thor_middleware.rb

Overview

Prepended module that wraps Thor command dispatch with smart feedback.

Instance Method Summary collapse

Instance Method Details

#dispatch(meth, given_args, given_opts, config) ⇒ Object

Dispatch a Thor command with smart feedback middleware.

Parameters:

  • meth (Object)

    the meth

  • given_args (Object)

    the given args

  • given_opts (Object)

    the given opts

  • config (Object)

    the config

Returns:

  • (Object)


33
34
35
36
37
38
39
# File 'lib/rosett_ai/smart_feedback/thor_middleware.rb', line 33

def dispatch(meth, given_args, given_opts, config)
  super
rescue ::Thor::UndefinedCommandError => e
  handle_unknown_command(e, given_args)
rescue ::Thor::UnknownArgumentError => e
  handle_unknown_argument(e)
end