#!/usr/bin/env ruby require "rocket_api" include RocketApi::Validation include RocketApi::Lib base_command, sub_command, project_name = ARGV.map{|cmd| cmd&.gsub(RocketApi::REGEXP_VALID, '')&.downcase } safe("RocketApi") do validate_commands(base_command, sub_command, project_name) available_to_init? raise RocketApi::WRONG_RESPONSE unless RocketApi::AVAILABLE_COMMANDS.keys.include?(base_command) if RocketApi::AVAILABLE_COMMANDS[base_command].keys.include?(sub_command) RocketApi::AVAILABLE_COMMANDS[base_command][sub_command].each do |key, collection| RocketApi::RocketCommands.send(key, collection: collection, project_name: project_name ) end else raise RocketApi::WRONG_RESPONSE end end