Sha256: 6997fcc4c1f0a1b4811113e9d839fe2469abbfba3fc559542f157ff42c546648

Contents?: true

Size: 919 Bytes

Versions: 21

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

require "sod"

module Rubysmith
  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 :rubysmith, banner: specification.banner do
          on(Sod::Prefabs::Commands::Config, context:)
          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

21 entries across 21 versions & 1 rubygems

Version Path
rubysmith-6.10.0 lib/rubysmith/cli/shell.rb
rubysmith-6.9.0 lib/rubysmith/cli/shell.rb
rubysmith-6.6.0 lib/rubysmith/cli/shell.rb
rubysmith-6.5.0 lib/rubysmith/cli/shell.rb
rubysmith-6.4.0 lib/rubysmith/cli/shell.rb
rubysmith-6.3.0 lib/rubysmith/cli/shell.rb
rubysmith-6.2.1 lib/rubysmith/cli/shell.rb
rubysmith-6.2.0 lib/rubysmith/cli/shell.rb
rubysmith-6.1.0 lib/rubysmith/cli/shell.rb
rubysmith-6.0.0 lib/rubysmith/cli/shell.rb
rubysmith-5.9.0 lib/rubysmith/cli/shell.rb
rubysmith-5.8.1 lib/rubysmith/cli/shell.rb
rubysmith-5.8.0 lib/rubysmith/cli/shell.rb
rubysmith-5.7.0 lib/rubysmith/cli/shell.rb
rubysmith-5.6.0 lib/rubysmith/cli/shell.rb
rubysmith-5.5.0 lib/rubysmith/cli/shell.rb
rubysmith-5.4.0 lib/rubysmith/cli/shell.rb
rubysmith-5.3.0 lib/rubysmith/cli/shell.rb
rubysmith-5.2.0 lib/rubysmith/cli/shell.rb
rubysmith-5.1.0 lib/rubysmith/cli/shell.rb