Sha256: d63156ddad28c1a612358f360304c68a645819da323f33de77f89636ab414824

Contents?: true

Size: 989 Bytes

Versions: 1

Compression:

Stored size: 989 Bytes

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 = {}

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_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
end

begin
  optparse.parse!
  if options[:service] && !options[:cluster]
    raise OptionParser::MissingArgument.new("If you want to connect to a service you need to specify a cluster name.")
    puts "\n"
  end
rescue OptionParser::InvalidOption, OptionParser::InvalidArgument, OptionParser::MissingArgument
  puts $ERROR_INFO.to_s.capitalize
  puts "\n"
  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.4.0 bin/contexto