module Meroku module CLI # A session is what is created when user executes the meroku command class Session include Meroku::CLI include Meroku::CLI::Help def initialize(args) processed = process_user_login_command(args.join(' ')) || process_user_other_command(args.join(' ')) || process_admin_command(args.join(' ')) puts "Unknown command #{args.join(' ')}\n\n#{help}" unless processed exit 1 unless processed end def process_user_login_command(arguments) case arguments when /\Asignup/ signup when 'logout' logout when 'login' login end end def process_user_other_command(arguments) case arguments when 'create' create when 'keys:add' keys_add end end def process_admin_command(arguments) case arguments when 'infrastructure spawn' spawn when 'infrastructure despawn' despawn end end end end end