Sha256: 62a50a6fbc0dfff004e3d91c88b003154ce39c630ee6d186c31003c26cf44b1f

Contents?: true

Size: 1.13 KB

Versions: 20

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require "sod"

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

          on "metadata", "Manage project metadata." do
            on Actions::Metadata::Create
            on Actions::Metadata::Delete
            on Actions::Metadata::Recreate
          end

          on Actions::Session
          on Actions::Snippets
          on Actions::Update
          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
sublime_text_kit-17.6.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-17.5.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-17.4.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-17.3.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-17.2.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-17.1.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-17.0.1 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-17.0.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-16.5.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-16.3.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-16.2.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-16.1.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-16.0.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-15.2.1 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-15.2.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-15.1.0 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-15.0.3 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-15.0.2 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-15.0.1 lib/sublime_text_kit/cli/shell.rb
sublime_text_kit-15.0.0 lib/sublime_text_kit/cli/shell.rb