require "magellan/cli" require 'thor' require 'active_support/core_ext/string/inflections' module Magellan module Cli class Command < Base { "organization" => "Organization", "team" => "Team", "project" => "Project", "stage" => "Stage", "client_version" => "ClientVersion", #"tr" => "TransactionRouter", "worker" => "Worker", "image" => "Image", "container" => "Container", "cloudsql" => "Cloudsql", }.each do |name, classname| desc "#{name} SUBCOMMAND ...ARGS", "manage #{name}" subcommand name, ::Magellan::Cli::Resources.const_get(classname) end #desc "direct SUBCOMMAND ...ARGS", "send request directly" #subcommand "direct", ::Magellan::Cli::Direct desc "login", "login to a Magellan API server" def login print "email: " email = STDIN.gets.chomp print "password: " password = STDIN.noecho(&:gets).chomp puts "" Magellan::Cli::Http.new.login!(email, password) end desc "version", "show version" def version $stdout.puts Magellan::Cli::VERSION end end end end