Sha256: 778a484746f9dbb12eff90be4132d1c411b3c2e70033ab5e00d9b2eea365abda

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

module TorrentSearch
  #Lets monkey patch Thor to have a default action with arguments!
  module DefaultCommand
    def dispatch(meth, given_args, given_opts, config)
      meth = retrieve_command_name(given_args)
      command = all_commands[normalize_command_name(meth)]
      unless command
        given_args.unshift meth
        meth = default_command
        command = all_commands[meth]
      end
      if given_args.empty? && command.name == default_command
        handle_argument_error(command, nil, given_args, nil)
      end
      super
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
torrent_search-0.0.3 lib/torrent_search/default_command.rb
torrent_search-0.0.2 lib/torrent_search/default_command.rb
torrent_search-0.0.1 lib/torrent_search/default_command.rb