Sha256: f5c9f8aed40b82465b4a62eccd085c0bed916ca2649b7383af505ccbca721768

Contents?: true

Size: 1001 Bytes

Versions: 28

Compression:

Stored size: 1001 Bytes

Contents

# frozen_string_literal: true

require "sod"

module Gemsmith
  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 :gemsmith, banner: specification.banner do
          on(Sod::Prefabs::Commands::Config, context:)
          on Commands::Build
          on Actions::Install
          on Actions::Publish
          on Actions::Edit
          on Actions::View
          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

28 entries across 28 versions & 1 rubygems

Version Path
gemsmith-22.10.0 lib/gemsmith/cli/shell.rb
gemsmith-22.9.0 lib/gemsmith/cli/shell.rb
gemsmith-22.8.0 lib/gemsmith/cli/shell.rb
gemsmith-22.7.0 lib/gemsmith/cli/shell.rb
gemsmith-22.6.0 lib/gemsmith/cli/shell.rb
gemsmith-22.5.0 lib/gemsmith/cli/shell.rb
gemsmith-22.4.0 lib/gemsmith/cli/shell.rb
gemsmith-22.3.0 lib/gemsmith/cli/shell.rb
gemsmith-22.2.0 lib/gemsmith/cli/shell.rb
gemsmith-22.1.0 lib/gemsmith/cli/shell.rb
gemsmith-22.0.0 lib/gemsmith/cli/shell.rb
gemsmith-21.10.0 lib/gemsmith/cli/shell.rb
gemsmith-21.9.0 lib/gemsmith/cli/shell.rb
gemsmith-21.6.0 lib/gemsmith/cli/shell.rb
gemsmith-21.5.1 lib/gemsmith/cli/shell.rb
gemsmith-21.5.0 lib/gemsmith/cli/shell.rb
gemsmith-21.4.0 lib/gemsmith/cli/shell.rb
gemsmith-21.3.0 lib/gemsmith/cli/shell.rb
gemsmith-21.2.0 lib/gemsmith/cli/shell.rb
gemsmith-21.1.0 lib/gemsmith/cli/shell.rb