Class: OpenSearch::CLI

Inherits:
OptionParser
  • Object
show all
Defined in:
lib/opensearch/cli.rb

Constant Summary collapse

VERSION =
"1.0.0"

Instance Method Summary collapse

Constructor Details

#initialize(banner = nil, width = 32, indent = " " * 4) {|_self| ... } ⇒ CLI

Returns a new instance of CLI.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/opensearch/cli.rb', line 10

def initialize(banner = nil, width = 32, indent = " " * 4, &block)
  @opensearch_options = {
    host: "https://localhost:9200",
    transport_options: {ssl: {}}
  }
  super(banner, width, indent) {}

  add_opensearch_options

  yield(self) if block
end

Instance Method Details

#clientObject



22
23
24
25
# File 'lib/opensearch/cli.rb', line 22

def client
  require "opensearch"
  @client ||= OpenSearch::Client.new(@opensearch_options)
end