Sha256: 8e3a24391b79b77faae32f87386195b1b6c49f3980e9e91d4d019773d4591d91
Contents?: true
Size: 531 Bytes
Versions: 3
Compression:
Stored size: 531 Bytes
Contents
# frozen_string_literal: true module Rodbot class CLI class Command < Dry::CLI::Command option :backtrace, type: :boolean, default: false, desc: "Dump backtrace on errors" def call(backtrace:, **args) rescued_call(**args) rescue => error error(error.message) do raise error if backtrace end end private def error(message) STDERR.puts "ERROR: command failed: #{message}" yield if block_given? exit 1 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rodbot-0.5.2 | lib/rodbot/cli/command.rb |
rodbot-0.5.1 | lib/rodbot/cli/command.rb |
rodbot-0.5.0 | lib/rodbot/cli/command.rb |