require "magellan/cli" require 'thor' require 'active_support/core_ext/string/inflections' module Magellan module Cli class Command < Base include Magellan::Cli::FileAccess { "organization" => "Organization", "team" => "Team", "project" => "Project", "stage" => "Stage", "client_version" => "ClientVersion", "tr" => "TransactionRouter", "worker" => "WorkerVersion", "instance" => "HostInstance", "image" => "ContainerImage", "container" => "ContainerInstance", }.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 "" update_selections("login" => {"email" => email, "password" => password}) end end end end