Sha256: 7f55e7d75a73bf84473f8d1d90a361296db17ab1a96ffd688939fd229ac0e3e0

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

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 = ($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

6 entries across 6 versions & 1 rubygems

Version Path
kumogata-0.2.12 bin/kumogata
kumogata-0.2.11 bin/kumogata
kumogata-0.2.10 bin/kumogata
kumogata-0.2.9 bin/kumogata
kumogata-0.2.8 bin/kumogata
kumogata-0.2.7 bin/kumogata