Sha256: ad2189c2fe97dbf4cc2b1affbe97762a1b260fb0dca7b2f8a969c2b44d2b8f6c

Contents?: true

Size: 921 Bytes

Versions: 6

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

require "sod"

module Milestoner
  module CLI
    # The main Command Line Interface (CLI) object.
    class Shell
      include Import[:defaults_path, :xdg_config, :specification]

      def initialize(context: Sod::Context, dsl: Sod, **)
        super(**)
        @context = context
        @dsl = dsl
      end

      def call(...) = cli.call(...)

      private

      attr_reader :context, :dsl

      def cli
        context = build_context

        dsl.new :milestoner, banner: specification.banner do
          on(Sod::Prefabs::Commands::Config, context:)
          on Actions::Publish
          on Actions::Status
          on(Sod::Prefabs::Actions::Version, context:)
          on Sod::Prefabs::Actions::Help, self
        end
      end

      def build_context
        context[defaults_path:, xdg_config:, version_label: specification.labeled_version]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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