# frozen_string_literal: true require "thor" require_relative "list" require_relative "audit" require_relative "upsert" require_relative "remove" require_relative "../../sub_command_base" module Neetob class CLI module Heroku module ConfigVars class Commands < SubCommandBase desc "list", "List all the config variables in the Heroku apps" option :apps, type: :array, aliases: :a, required: true, desc: "Heroku app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web-staging\"" option :keys, type: :array, desc: "Array of config vars that needs to be listed." option :path, type: :string, desc: "The JSON file path which has config vars that needs to be listed" def list List.new(options[:apps], options[:keys], options[:path], options[:sandbox]).process end desc "audit", "Verify whether config vars set in Heroku apps matches against the conditions specified in JSON file." option :apps, type: :array, aliases: :a, required: true, desc: "Heroku app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web-staging\"" option :path, type: :string, desc: "The JSON file path from which config vars will be compared" def audit Audit.new(options[:apps], options[:path], options[:sandbox]).process end desc "upsert", "Update and insert the config vars in Heroku apps" option :apps, type: :array, aliases: :a, desc: "Heroku app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web-staging\"" option :path, type: :string, aliases: :p, desc: "The JSON file path from which config vars will be upserted" option :path_with_project_keys, type: :string, desc: "The JSON file path with the project names as the key containing required config vars for each project." def upsert Upsert.new(options[:apps], options[:path], options[:path_with_project_keys], options[:sandbox]).process end desc "remove", "Remove the config vars from Heroku apps" option :apps, type: :array, aliases: :a, required: true, desc: "Heroku app names. Can be matched using the '*' wildcard. Example: \"neeto*\" \"neeto-cal-web-staging\"" option :keys, type: :array, required: true, desc: "Array of config vars to be removed." def remove Remove.new(options[:apps], options[:keys], options[:sandbox]).process end end end end end end