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



31
32
33
# File 'lib/diamante/cli.rb', line 31

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)


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

def self.exit_on_failure?
  true
end

Instance Method Details

#respond_to_missing?(_method_name) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/diamante/cli.rb', line 35

def respond_to_missing?(_method_name)
  true
end

#restartObject



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

def restart
  require 'io/console'

  STDIN.cooked!
  STDIN.echo = true
end

#show(filepath) ⇒ Object



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

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