Class: Metanorma::Cli::UI

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

Class Method Summary collapse

Class Method Details

.ask(message, options = {}) ⇒ Object



6
7
8
# File 'lib/metanorma/cli/ui.rb', line 6

def self.ask(message, options = {})
  new.ask(message, options)
end

.debug(message, enabled: false) ⇒ Object



18
19
20
21
22
# File 'lib/metanorma/cli/ui.rb', line 18

def self.debug(message, enabled: false)
  if enabled
    new.say(["[debug]", message].join(": "))
  end
end

.error(message) ⇒ Object



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

def self.error(message)
  new.error(message)
end

.info(message) ⇒ Object



14
15
16
# File 'lib/metanorma/cli/ui.rb', line 14

def self.info(message)
  new.say(["[info]", message].join(": "))
end

.run(command) ⇒ Object



32
33
34
35
# File 'lib/metanorma/cli/ui.rb', line 32

def self.run(command)
  require "open3"
  Open3.capture3(command)
end

.say(message) ⇒ Object



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

def self.say(message)
  new.say(message)
end

.table(header, data) ⇒ Object



28
29
30
# File 'lib/metanorma/cli/ui.rb', line 28

def self.table(header, data)
  new.print_table(data.unshift(header))
end