Class: SRS::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/srs/cli.rb,
lib/srs/cli/cat.rb,
lib/srs/cli/help.rb,
lib/srs/cli/init.rb,
lib/srs/cli/queue.rb,
lib/srs/cli/next-due.rb,
lib/srs/cli/next-new.rb,
lib/srs/cli/schedule.rb,
lib/srs/cli/get-field.rb,
lib/srs/cli/reschedule.rb,
lib/srs/cli/do-exercise.rb,
lib/srs/cli/insert-into.rb

Defined Under Namespace

Classes: Cat, DoExercise, GetField, Help, Init, InsertInto, NextDue, NextNew, Queue, Reschedule, Schedule

Constant Summary collapse

COMMANDS =
{ "init"            => :Init,
"insert-into"     => :InsertInto,
"schedule"        => :Schedule,
"do-exercise"     => :DoExercise,
"reschedule"      => :Reschedule,
"queue"           => :Queue,
"next-due"        => :NextDue,
"next-new"        => :NextNew,
"get-field"       => :GetField,
"cat"             => :Cat,
"help"            => :Help }.freeze

Class Method Summary collapse

Class Method Details

.cmd_to_symbol(command) ⇒ Object



28
29
30
# File 'lib/srs/cli.rb', line 28

def cmd_to_symbol(command)
	return COMMANDS[command]
end

.run!(*arguments) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/srs/cli.rb', line 32

def run!(*arguments)
	command = cmd_to_symbol(arguments.shift)
	if command
		return SRS::CLI.const_get(command).new.run!(arguments)
	else
		return SRS::CLI::Help.new.run!([])
	end
end