Class: CodeUnion::Command::Search

Inherits:
Base
  • Object
show all
Includes:
Helpers::Text
Defined in:
lib/codeunion/command/search.rb

Overview

The built-in ‘codeunion search` command

Instance Method Summary collapse

Methods included from Helpers::Text

#format_output, #indent, #wrap

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from CodeUnion::Command::Base

Instance Method Details

#resultsObject



23
24
25
# File 'lib/codeunion/command/search.rb', line 23

def results
  @results ||= api.search(options)
end

#runObject



16
17
18
19
20
21
# File 'lib/codeunion/command/search.rb', line 16

def run
  results.inject([]) do |lines, result|
    lines.push(CodeUnion::Search::ResultPresenter.new(result).to_s)
    lines << format_output("")
  end.join("\n")
end