Sha256: e6ee9f1e240efd9c49091dfd346f2ab9d2cd6048cc30d1b61dc6c5f1625bb85b

Contents?: true

Size: 882 Bytes

Versions: 20

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

require "sod"

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

20 entries across 20 versions & 1 rubygems

Version Path
tocer-18.7.0 lib/tocer/cli/shell.rb
tocer-18.6.0 lib/tocer/cli/shell.rb
tocer-18.5.0 lib/tocer/cli/shell.rb
tocer-18.4.0 lib/tocer/cli/shell.rb
tocer-18.3.0 lib/tocer/cli/shell.rb
tocer-18.2.0 lib/tocer/cli/shell.rb
tocer-18.1.0 lib/tocer/cli/shell.rb
tocer-18.0.0 lib/tocer/cli/shell.rb
tocer-17.5.0 lib/tocer/cli/shell.rb
tocer-17.3.0 lib/tocer/cli/shell.rb
tocer-17.2.0 lib/tocer/cli/shell.rb
tocer-17.1.0 lib/tocer/cli/shell.rb
tocer-17.0.0 lib/tocer/cli/shell.rb
tocer-16.2.1 lib/tocer/cli/shell.rb
tocer-16.2.0 lib/tocer/cli/shell.rb
tocer-16.1.0 lib/tocer/cli/shell.rb
tocer-16.0.3 lib/tocer/cli/shell.rb
tocer-16.0.2 lib/tocer/cli/shell.rb
tocer-16.0.1 lib/tocer/cli/shell.rb
tocer-16.0.0 lib/tocer/cli/shell.rb