Sha256: 30a53804c44d0f4e295dd5517c8bfbc07ab514284c22c1623c71d6aad2da1fcb

Contents?: true

Size: 580 Bytes

Versions: 4

Compression:

Stored size: 580 Bytes

Contents

require 'scaffolder/tool_index'

module Scaffolder::BinaryHelper
  include Scaffolder::ToolIndex

  DEFAULT_TOOL = Scaffolder::Tool::Help

  def select_tool(name)
    tool_exists?(name) ? get_tool(name) : DEFAULT_TOOL
  end

  def remove_first_argument(settings)
    name = settings.rest.shift
  end

  def determine_tool(settings)
    name = remove_first_argument(settings)

    tool_class = select_tool(name)

    if name.nil?
      settings[:empty_args] = true
    elsif not tool_exists?(name)
      settings[:unknown_tool] = name
    end

    [tool_class,settings]
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scaffolder-tools-0.1.3 lib/scaffolder/binary_helper.rb
scaffolder-tools-0.1.2 lib/scaffolder/binary_helper.rb
scaffolder-tools-0.1.1 lib/scaffolder/binary_helper.rb
scaffolder-tools-0.1.0 lib/scaffolder/binary_helper.rb