Class: Wordword::CLI

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

Overview

Handle the application command line parsing and the dispatch to various command objects

Constant Summary collapse

Error =

Error raised by this runner

Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#composeObject



27
28
29
30
31
32
33
34
# File 'lib/wordword/cli.rb', line 27

def compose(*)
  if options[:help]
    invoke :help, ["compose"]
  else
    require_relative "commands/compose"
    Wordword::Commands::Compose.new(options).execute
  end
end

#train(file = nil) ⇒ Object



41
42
43
44
45
46
47
48
# File 'lib/wordword/cli.rb', line 41

def train(file = nil)
  if options[:help]
    invoke :help, ["train"]
  else
    require_relative "commands/train"
    Wordword::Commands::Train.new(file, options).execute
  end
end

#versionObject



17
18
19
20
21
# File 'lib/wordword/cli.rb', line 17

def version
  require_relative "version"
  puts File.read(File.join(File.dirname(__FILE__), "..", "..", "assets/logo.txt"))
  puts "v#{Wordword::VERSION}"
end