Sha256: c929ff8e749e34af8ce0a96ec16645dcf9d737cb4bb0beb1b192699e2c2d6d6c
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 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 = {} 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contexto-0.4.1 | bin/contexto |