Sha256: a86577d790653ddf5de8a5c113b04d091c4a63e797e2f05278b51fcfe9993c99

Contents?: true

Size: 1.06 KB

Versions: 14

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env ruby
$: << File.expand_path("#{File.dirname __FILE__}/../lib")
require 'rubygems'
require 'kumogata'

options = nil

parsed = Kumogata::ArgumentParser.parse! {|parser, cmd, args, opts|
  if (opts.access_key_id? and not opts.secret_access_key?) or
     (not opts.access_key_id? and opts.secret_access_key?)
    puts parser.help
    exit 1
  end
}

begin
  command, arguments, options = parsed

  aws_opts = {}

  [:access_key_id, :secret_access_key, :region].each do |key|
    aws_opts[key] = options[key] if options[key]
  end

  AWS.config(aws_opts) unless aws_opts.empty?

  String.colorize = ($stdout.tty? and options.color?)
  Diffy::Diff.default_format = ($stdout.tty? and options.color?) ? :color : :text

  if options.debug?
    Kumogata.logger.set_debug(true)

    AWS.config({
      :http_wire_trace => true,
      :logger => Kumogata.logger,
    })
  end

  out = Kumogata::Client.new(options).send(command, *arguments)
  puts out if out
rescue => e
  $stderr.puts("[ERROR] #{e.message}".red)

  if options and options.debug?
    raise e
  end

  exit 1
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kumogata-0.3.6 bin/kumogata
kumogata-0.3.5 bin/kumogata
kumogata-0.3.4 bin/kumogata
kumogata-0.3.3 bin/kumogata
kumogata-0.3.2 bin/kumogata
kumogata-0.3.1 bin/kumogata
kumogata-0.3.0 bin/kumogata
kumogata-0.2.19 bin/kumogata
kumogata-0.2.18 bin/kumogata
kumogata-0.2.17 bin/kumogata
kumogata-0.2.16 bin/kumogata
kumogata-0.2.15 bin/kumogata
kumogata-0.2.14 bin/kumogata
kumogata-0.2.13 bin/kumogata