# coding: utf-8
require 'thor'

module Cocoapods::Search
  class Command < Thor
    map '-v' => :version,
        '--version' => :version

    default_command :search

    desc :version, 'Show version'
    def version
      say "cocoapods-search version: #{VERSION}", :green
    end

    desc 'search [NAME]', 'Search cocopapods'
    def search(name = nil)
      return invoke :help unless name
      cs = Cocoapods::Search::Executor.new
      cs.search(name)
    rescue LibraryNotFound => e
      say e.message, :red
      abort
    rescue OldRepositoryError => e
      # repository 更新時はエラーとする
      say '[cocoapods-search] Plz update your repository and retry.', :red
      say e.message
      abort
    rescue PodError => e
      say e.message
      abort
    end

    private
      def method_missing(name)
        Command.start ['search', name.to_s]
      end
  end
end
# coding: utf-8
require 'thor'

module Cocoapods::Search
  class Command < Thor
    map '-v' => :version,
        '--version' => :version

    default_command :search

    desc :version, 'Show version'
    def version
      say "cocoapods-search version: #{VERSION}", :green
    end

    desc 'search [NAME]', 'Search cocopapods'
    def search(name = nil)
      return invoke :help unless name
      cs = Cocoapods::Search::Cli.new
      cs.search(name)
    rescue LibraryNotFound => e
      say e.message, :red
      abort
    rescue OldRepositoryError => e
      # repository 更新時はエラーとする
      say '[cocoapods-search] Plz update your repository and retry.', :red
      say e.message
      abort
    rescue PodError => e
      say e.message
      abort
    end

    private
      def method_missing(name)
        Command.start ['search', name.to_s]
      end
  end
end
--- 
+++ 
@@ -16,7 +16,7 @@
     desc 'search [NAME]', 'Search cocopapods'
     def search(name = nil)
       return invoke :help unless name
-      cs = Cocoapods::Search::Cli.new
+      cs = Cocoapods::Search::Executor.new
       cs.search(name)
     rescue LibraryNotFound => e
       say e.message, :red
Fix a leak in bd280b2 :Rename class name from Cli to Executor[ci skip]
