Sha256: 77e5fb67d8d4827f469aca02668ab957aa297ec8b99189605cfd42e293874600

Contents?: true

Size: 963 Bytes

Versions: 7

Compression:

Stored size: 963 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, :specification, xdg_config: "xdg.config"]

      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 Commands::Cache
          on Commands::Build
          on Actions::Publish
          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

7 entries across 7 versions & 1 rubygems

Version Path
milestoner-17.6.0 lib/milestoner/cli/shell.rb
milestoner-17.5.0 lib/milestoner/cli/shell.rb
milestoner-17.4.0 lib/milestoner/cli/shell.rb
milestoner-17.3.0 lib/milestoner/cli/shell.rb
milestoner-17.2.0 lib/milestoner/cli/shell.rb
milestoner-17.1.0 lib/milestoner/cli/shell.rb
milestoner-17.0.0 lib/milestoner/cli/shell.rb