Sha256: 4bd71e30f735ddddb03237b198b4004eb729249d0ec1d8907ed87a223ba5cbbe
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 KB
Contents
require 'thor' module SearchKit class Indices class CLI < Thor include Messaging namespace :indices desc "show slug", "View an index" def show(slug) response = client.show(slug) info response.to_json rescue Errors::IndexNotFound warning "No index for that slug found" rescue Faraday::ConnectionFailed warning "No running service found" end desc "create NAME", "Create an index" def create(name) response = client.create(name) info response.to_json rescue Errors::BadRequest warning "Bad create request" rescue Errors::Unprocessable warning "Options given unprocessable" rescue Faraday::ConnectionFailed warning "No running service found" end desc "update SLUG", "Update an index" option :name def update(slug) response = client.update(slug, options) info response.to_json rescue Errors::BadRequest warning "Bad update request" rescue Errors::IndexNotFound warning "No index for that slug found" rescue Errors::Unprocessable warning "Options given unprocessable" rescue Faraday::ConnectionFailed warning "No running service found" end desc "archive SLUG", "Archive an index" def archive(slug) response = client.delete(slug) info response.to_json rescue Errors::IndexNotFound warning "No index for that slug found" rescue Faraday::ConnectionFailed warning "No running service found" end private def client @client ||= Indices.new end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
search-kit-0.0.2 | lib/search_kit/indices/cli.rb |
search-kit-0.0.1 | lib/search_kit/indices/cli.rb |