The project is in a healthy, maintained state
Wrapper for Ruby's OptionParser to connect to OpenSearch
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0.0, < 4.0.0
 Project Readme

OpenSearch::CLI

A wrapper around Ruby's OptionParser to to connect to OpenSearch.

It provide options similar to the curl command line tool and handle creation of a client to connect to an OpenSearch cluster from your CLI application.

OpenSearch options:
        --url=URL                    URL of the OpenSearch instance
        --cacert=CERTIFICATE         Verify certificate against the provided CERTIFICATE
        --cert=CERTIFICATE           Use the provided CERTIFICATE for TLS client authentication
        --key=KEY                    Use the provided KEY for TLS client authentication
    -k, --insecure                   Skip certificate verification against trust store
    -u, --user=USER[:PASSWORD]       Specify the user name and password to use for authentication
    -v, --verbose                    Show what's going on "under the hood"

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add opensearch-ruby-cli

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install opensearch-ruby-cli

Usage

Basic usage:

require 'opensearch/cli'

cli = OpenSearch::CLI.new
cli.parse!(ARGV)
cli.client.search(index: 'my-index', body: { query: { match_all: {} } })

Advanced usage:

require 'opensearch/cli'

options = {
  index: 'default'
}

cli = OpenSearch::CLI.new do |opts|
  opts.separator ''
  opts.separator 'Options:'
  opts.on('-i', '--index=INDEX', 'Work on INDEX') do |index|
    options[:index] = index
  end
end
cli.load # Load user defaults
cli.parse!(ARGV)
cli.client.search(index: options[:index], body: { query: { match_all: {} } })

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/opus-codium/opensearch-ruby-cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Opensearch::Ruby::Cli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.