Sha256: f8466f1dbb03add167b8f5676e449eb2a17395063b3ca25f4015ae1bf1c893f4

Contents?: true

Size: 953 Bytes

Versions: 20

Compression:

Stored size: 953 Bytes

Contents

require "sod"

<% namespace do %>
  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 <%= configuration.project_levels.positive? ? configuration.project_name.inspect : configuration.project_name.to_sym.inspect %>, banner: specification.banner do
          on(Sod::Prefabs::Commands::Config, context:)
          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
gemsmith-21.10.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.9.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.6.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.5.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.5.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.4.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.3.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-21.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.7.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.6.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.6.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.5.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.4.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.3.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.2.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-20.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb