Sha256: 5f35ab0582105a0019920c6b5bd1b986aebd22b2c51acb48d8f3df9b945bfa6b

Contents?: true

Size: 628 Bytes

Versions: 3

Compression:

Stored size: 628 Bytes

Contents

# frozen_string_literal: true

module Specimen
  module Command
    class Base < Thor
      include Thor::Actions

      class << self
        def exit_on_failure?
          false
        end
      end

      no_commands do
        def usage_path
          find_in_source_paths('USAGE')
        rescue Thor::Error
          ''
        end

        def usage_content
          return '' if usage_path.empty?

          File.read(usage_path)
        end

        def class_usage
          return nil if usage_content.empty?

          ERB.new(usage_content, trim_mode: '-').result(binding)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
specimen-0.0.4.alpha lib/specimen/command/base.rb
specimen-0.0.3.alpha lib/specimen/command/base.rb
specimen-0.0.2.alpha lib/specimen/command/base.rb