Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 7f7a7ac77a
Fetching contributors…

Cannot retrieve contributors at this time

executable file 31 lines (26 sloc) 1.034 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
require './command'

class Help

  ALL_COMMANDS = {"load" => "loads a new file",
                    "help" => "shows a list of available commands",
                    "queue" => "a set of data",
                    "queue count" => "total items in the queue",
                    "queue clear" => "empties the queue",
                    "queue print" => "prints to the queue",
                    "queue print by" => "prints the specified attribute",
                    "queue save to" => "exports queue to a CSV",
                    "find" => "load the queue with matching records"}

  def self.for(parameters)
    if parameters == []
      puts "Type 'help' before any of these terms for more detail:"
      "#{ALL_COMMANDS.keys.join(", ")}"
    else
      "#{parameters.join(" ")}: " + ALL_COMMANDS[parameters.join(" ")]
    end
  end

  def self.valid_command?(command)
    ALL_COMMANDS.keys.include?(command)
  end

  def self.valid_params?(parameters)
    parameters.empty? || valid_command?(parameters.join(" "))
  end
end
Something went wrong with that request. Please try again.