class Pragmater::CLI::Shell

The main Command Line Interface (CLI) object.

Public Class Methods

new(context: Sod::Context, dsl: Sod, **) click to toggle source
Calls superclass method
# File lib/pragmater/cli/shell.rb, line 11
def initialize(context: Sod::Context, dsl: Sod, **)
  super(**)
  @context = context
  @dsl = dsl
end

Public Instance Methods

build_context() click to toggle source
# File lib/pragmater/cli/shell.rb, line 35
def build_context
  context[defaults_path:, xdg_config:, version_label: specification.labeled_version]
end
call(...) click to toggle source
# File lib/pragmater/cli/shell.rb, line 17
  def call(...) = cli.call(...)

  private

  attr_reader :context, :dsl

  def cli
    context = build_context

    dsl.new :pragmater, banner: specification.banner do
      on(Sod::Prefabs::Commands::Config, context:)
      on Commands::Insert
      on Commands::Remove
      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
cli() click to toggle source
# File lib/pragmater/cli/shell.rb, line 23
def cli
  context = build_context

  dsl.new :pragmater, banner: specification.banner do
    on(Sod::Prefabs::Commands::Config, context:)
    on Commands::Insert
    on Commands::Remove
    on(Sod::Prefabs::Actions::Version, context:)
    on Sod::Prefabs::Actions::Help, self
  end
end