Sha256: 15d0a7b16abe19ca02772c02d1ebd59318e70ffa8d6cdebca310f4a1086a4ab4
Contents?: true
Size: 1012 Bytes
Versions: 5
Compression:
Stored size: 1012 Bytes
Contents
module Chronicle module ETL module CLI # Base class for CLI commands class CLIBase < ::Thor no_commands do # Shorthand for cli_exit(status: :failure) def cli_fail(message: nil, exception: nil) cli_exit(status: :failure, message: message, exception: exception) end # Exit from CLI # # @params status Can be eitiher :success or :failure # @params message to print # @params exception stacktrace if log_level is set to debug def cli_exit(status: :success, message: nil, exception: nil) exit_code = status == :success ? 0 : 1 log_level = status == :success ? :info : :fatal message = message.red if status != :success Chronicle::ETL::Logger.debug(exception.full_message) if exception Chronicle::ETL::Logger.send(log_level, message) if message exit(exit_code) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems