Class: Bookwatch::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(command, *args) ⇒ Object

desc ‘imprint <local|remote> [options]’, ‘DISABLED: Generate a PDF for a given book’

option :verbose, type: :boolean
option 'dita-flags', desc: '--dita-flags=\"<dita-option>=<value>\"'
def imprint(source)
  code = legacy_commands.imprint(source, options[:verbose], options['dita-flags'])
  raise Thor::Error, '' if code != 0
end


79
80
81
82
83
# File 'lib/bookwatch/cli.rb', line 79

def method_missing(command, *args)
  puts "Unknown command '#{command}'"
  puts ""
  help
end

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/bookwatch/cli.rb', line 10

def self.exit_on_failure?
  true
end

Instance Method Details

#help(command = nil) ⇒ Object



24
25
26
# File 'lib/bookwatch/cli.rb', line 24

def help(command=nil)
  super
end

#versionObject



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

def version
  gemspec = File.expand_path('../../../bookwatch.gemspec', __FILE__)
  say "bookwatch #{Gem::Specification::load(gemspec).version}"
end

#watch(*repos) ⇒ Object

Raises:

  • (Thor::Error)


64
65
66
67
# File 'lib/bookwatch/cli.rb', line 64

def watch(*repos)
  code = legacy_commands.watch(repos)
  raise Thor::Error, '' if code != 0
end