Sha256: 553a5fb2d79dd2ffb3c7b51f76afdc342d2e1cacf9a88beb99bbe1cb389b8c0c
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 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[:connection_type] = 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('-v', '--container CONTAINER', 'Container') { |v| options[:container] = v } opts.on('-t', "--type [TYPE]", [:console, :ssh, :bash], "Select connection type (console, ssh, bash)") { |v| options[:connection_type] = v } opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end begin optparse.parse! if options[:connection_type] && !options[:container] raise OptionParser::MissingArgument.new("If you want to connect to a container you need to specify a container 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contexto-0.3.1 | bin/contexto |
contexto-0.3.0 | bin/contexto |