Sha256: c4b4106a95be4dcf58d5863519b6e047c3d5357a86fb806052704337c39e8522

Contents?: true

Size: 996 Bytes

Versions: 17

Compression:

Stored size: 996 Bytes

Contents

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

options = nil

begin
  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
  }

  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 = options.color?

  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

17 entries across 17 versions & 1 rubygems

Version Path
kumogata-0.2.6 bin/kumogata
kumogata-0.2.5 bin/kumogata
kumogata-0.2.4 bin/kumogata
kumogata-0.2.3 bin/kumogata
kumogata-0.2.2 bin/kumogata
kumogata-0.2.1 bin/kumogata
kumogata-0.2.0 bin/kumogata
kumogata-0.1.9 bin/kumogata
kumogata-0.1.8 bin/kumogata
kumogata-0.1.7 bin/kumogata
kumogata-0.1.6 bin/kumogata
kumogata-0.1.5 bin/kumogata
kumogata-0.1.4 bin/kumogata
kumogata-0.1.3 bin/kumogata
kumogata-0.1.2 bin/kumogata
kumogata-0.1.1 bin/kumogata
kumogata-0.1.0 bin/kumogata