Sha256: fe5ae45f59669e1301e98ee76a7a2fb52cd785a7b38653b551dd2fd6aa02c847

Contents?: true

Size: 962 Bytes

Versions: 10

Compression:

Stored size: 962 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module CLI
    # The main Command Line Interface (CLI) object.
    class Shell
      include Actions::Import[:config, :publish, :status, :specification, :logger]

      def initialize parser: Parser.new, **dependencies
        super(**dependencies)
        @parser = parser
      end

      def call arguments = []
        perform parser.call(arguments)
      rescue OptionParser::ParseError, Error => error
        logger.error { error.message }
      end

      private

      attr_reader :parser

      def perform configuration
        case configuration
          in action_config: Symbol => action then config.call action
          in action_publish: true then publish.call configuration
          in action_status: true then status.call
          in action_version: true then logger.info { specification.labeled_version }
          else logger.any { parser.to_s }
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
milestoner-15.1.0 lib/milestoner/cli/shell.rb
milestoner-15.0.0 lib/milestoner/cli/shell.rb
milestoner-14.5.0 lib/milestoner/cli/shell.rb
milestoner-14.4.0 lib/milestoner/cli/shell.rb
milestoner-14.3.0 lib/milestoner/cli/shell.rb
milestoner-14.2.0 lib/milestoner/cli/shell.rb
milestoner-14.1.0 lib/milestoner/cli/shell.rb
milestoner-14.0.2 lib/milestoner/cli/shell.rb
milestoner-14.0.1 lib/milestoner/cli/shell.rb
milestoner-14.0.0 lib/milestoner/cli/shell.rb