Module: CMD::Utils
Instance Method Summary collapse
Instance Method Details
#execute_command(command, error_key, args = {}) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/cmd.rb', line 5 def execute_command(command, error_key, args = {}) success = system(command) unless success error = I18n.t("errors.#{error_key}", **args) print_error(error) end end |
#print_error(error) ⇒ Object
13 14 15 16 17 |
# File 'lib/cmd.rb', line 13 def print_error(error) puts "Error Code: #{error[:code]}" puts "Error Type: #{error[:type]}" puts "Message: #{error[:message]}" end |