bin/contexto in contexto-0.3.1 vs bin/contexto in contexto-0.4.0
- old
+ new
@@ -9,27 +9,24 @@
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.")
+ 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"