Sha256: 1a827299240fa6fbc48b1d87e4fee22c37613e6d7ae71554a0ea05c5b7dfada2

Contents?: true

Size: 889 Bytes

Versions: 10

Compression:

Stored size: 889 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(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

10 entries across 10 versions & 1 rubygems

Version Path
rubysmith-7.9.0 lib/rubysmith/cli/shell.rb
rubysmith-7.8.0 lib/rubysmith/cli/shell.rb
rubysmith-7.7.0 lib/rubysmith/cli/shell.rb
rubysmith-7.6.0 lib/rubysmith/cli/shell.rb
rubysmith-7.5.0 lib/rubysmith/cli/shell.rb
rubysmith-7.4.0 lib/rubysmith/cli/shell.rb
rubysmith-7.3.0 lib/rubysmith/cli/shell.rb
rubysmith-7.2.0 lib/rubysmith/cli/shell.rb
rubysmith-7.1.0 lib/rubysmith/cli/shell.rb
rubysmith-7.0.0 lib/rubysmith/cli/shell.rb