Class: Evoke::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/evoke/cli.rb

Overview

The command-line-interface for Evoke.

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



4
5
6
7
8
9
# File 'lib/evoke/cli.rb', line 4

def initialize
  @command = ARGV.shift
  @arguments = ARGV.dup

  ARGV.clear
end

Instance Method Details

#startObject

Starts the CLI. This will check lib/tasks in the current working directory for evoke tasks and invoke the task supplied on the command line.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/evoke/cli.rb', line 13

def start
  load_tasks

  return no_tasks if tasks.empty?
  return usage if @command.nil?
  return syntax if @command == 'help'

  task = Evoke.find_task(@command) unless @command.nil?

  return unknown_command if task.nil?

  Evoke.invoke(task, *@arguments)
end