Class: Exa::CLI::SearchParser

Inherits:
Object
  • Object
show all
Defined in:
lib/exa/cli/search_parser.rb

Constant Summary collapse

VALID_SEARCH_TYPES =
["auto", "neural", "fast", "deep", "deep-reasoning", "instant"].freeze
VALID_TEXT_VERBOSITY =
["compact", "standard", "full"].freeze
VALID_CATEGORIES =
[
  "company", "research paper", "news", "github",
  "tweet", "personal site", "financial report", "people"
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ SearchParser

Returns a new instance of SearchParser.



17
18
19
20
21
22
23
# File 'lib/exa/cli/search_parser.rb', line 17

def initialize(argv)
  @argv = argv
  @args = {
    output_format: "json",
    api_key: nil
  }
end

Class Method Details

.parse(argv) ⇒ Object



13
14
15
# File 'lib/exa/cli/search_parser.rb', line 13

def self.parse(argv)
  new(argv).parse
end

Instance Method Details

#parseObject



25
26
27
28
29
# File 'lib/exa/cli/search_parser.rb', line 25

def parse
  parse_arguments
  validate_query
  @args
end