Sha256: be3b50bbebbc5cce9b8d81d6c88f6b9f85dea2fa1d2b989ec92930dfc3d3d325

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 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'
require 'dotenv/load'

$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
  opts.on_tail('-v', '--version', 'Show version') do
    puts Contexto::VERSION
    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

4 entries across 4 versions & 1 rubygems

Version Path
contexto-0.4.5 bin/contexto
contexto-0.4.4 bin/contexto
contexto-0.4.3 bin/contexto
contexto-0.4.2 bin/contexto