# frozen_string_literal: true module LeapSalesforce # Helpers for LeapSalesforce executable module ExeHelpers # Return input for query # @param [String] query Query to ask on terminal # @return [String] User input to store def input_for(query) puts query $stdin.gets.strip end # Ask user to enter parameters specific to their Salesforce environment def query_for_parameters puts 'Please enter the following information to generate files for a new leap_salesforce testing repo' # Ask for OAuth credential details @client_id = options[:client_id] || input_for('Enter the client id') @client_secret = options[:client_secret] || input_for('Enter the client secret') @username = options[:username] || input_for('Enter the Salesforce username. It is ideal to start with a System admin' \ ' so that any necessary metadata can be read') @user_key = options[:user_key] || input_for('Enter a key to refer to this user (This will be stored as a Symbol)') @password = options[:password] || input_for('Enter password for this user. Recommendation is that 1 password be shared across' \ ' all test users to be easier to manage') @environment = options[:environment] || input_for('Enter the environment you want to set things up for ' \ '(This will be parameterised so can be changed later)') end end end