Sha256: 72d82178d03e15ae1f2642b20685c48835dcd97adfee352a68a41f9c7d8eabd7

Contents?: true

Size: 940 Bytes

Versions: 6

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true

require "sod"

module Milestoner
  module CLI
    module Actions
      # Handles listing project status of untagged commit history.
      class Status < Sod::Action
        include Milestoner::Import[:kernel, :logger]

        description "Show project status."

        on %w[-s --status]

        def initialize(presenter: Presenters::Commit, categorizer: Commits::Categorizer.new, **)
          super(**)
          @presenter = presenter
          @categorizer = categorizer
        end

        def call(*)
          categorizer.call
                     .tap { |records| info "All is quiet." if records.empty? }
                     .map { |record| presenter.new(record).line_item }
                     .each { |line_item| kernel.puts line_item }
        end

        private

        attr_reader :presenter, :categorizer

        def info(message) = logger.info { message }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
milestoner-16.2.1 lib/milestoner/cli/actions/status.rb
milestoner-16.2.0 lib/milestoner/cli/actions/status.rb
milestoner-16.1.0 lib/milestoner/cli/actions/status.rb
milestoner-16.0.2 lib/milestoner/cli/actions/status.rb
milestoner-16.0.1 lib/milestoner/cli/actions/status.rb
milestoner-16.0.0 lib/milestoner/cli/actions/status.rb