Sha256: 7396990fe550e2be507c4637b44a8901b840af31028e955011cbca72dd89fe02

Contents?: true

Size: 938 Bytes

Versions: 11

Compression:

Stored size: 938 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 <%= settings.project_levels.positive? ? settings.project_name.inspect : settings.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

11 entries across 11 versions & 1 rubygems

Version Path
gemsmith-22.10.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.9.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.8.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.7.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.6.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.5.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.4.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.3.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-22.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb