Sha256: 622827624a7fa4e9493387ea09655665c44402b6b99263798a483be6899d614a

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby

lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'rubygems'
require 'contexto'
require 'optparse'
require 'English'

$stderr.sync = true

options = {}
options[:cluster] = 'sandbox'
options[:ssh]     = false

optparse = OptionParser.new do |opts|
  opts.banner = 'Usage: contexto [options]'
  opts.on('-c', '--cluster CLUSTER', 'Cluster') { |v| options[:cluster] = v }
  opts.on('-s', '--service SERVICE', 'Service') { |v| options[:service] = v }
  opts.on('-t', '--container CONTAINER', 'Container') { |v| options[:container] = v }
  opts.on('-b', '--ssh') { options[:ssh] = true }
end

begin
  optparse.parse!
  mandatory = [:cluster]
  missing = mandatory.select { |param| options[param].nil? }
  unless missing.empty?
    raise OptionParser::MissingArgument.new(missing.join(', '))
  end
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
  puts $ERROR_INFO.to_s
  puts optparse
  exit
end

c = Contexto::Contextualize.new(options)
c.run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
contexto-0.1.1 bin/contexto