Class: CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/diamante/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(method, *_args, &_block) ⇒ Object



37
38
39
# File 'lib/diamante/cli.rb', line 37

def method_missing(method, *_args, &_block)
  show(method.to_s)
end

Class Method Details

.exit_on_failure?Boolean

Thor stop and show messages on screen on failure

Returns:

  • (Boolean)


47
48
49
# File 'lib/diamante/cli.rb', line 47

def self.exit_on_failure?
  true
end

Instance Method Details

#new(dirpath) ⇒ Object



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

def new(dirpath)
  Diamante.new(dirpath)
end

#respond_to_missing?(_method_name) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/diamante/cli.rb', line 41

def respond_to_missing?(_method_name)
  true
end

#restartObject



24
25
26
27
28
29
# File 'lib/diamante/cli.rb', line 24

def restart
  require 'io/console'

  STDIN.cooked!
  STDIN.echo = true
end

#show(filepath) ⇒ Object



33
34
35
# File 'lib/diamante/cli.rb', line 33

def show(filepath)
  Diamante::show(filepath)
end

#versionObject



11
12
13
14
# File 'lib/diamante/cli.rb', line 11

def version
  puts "diamante version #{Diamante::VERSION}"
  exit 0
end