Class: Metanorma::Cli::UI
- Inherits:
-
Thor
- Object
- Thor
- Metanorma::Cli::UI
- Defined in:
- lib/metanorma/cli/ui.rb
Class Method Summary collapse
- .ask(message, options = {}) ⇒ Object
- .debug(message, enabled: false) ⇒ Object
- .error(message) ⇒ Object
- .info(message) ⇒ Object
- .run(command) ⇒ Object
- .say(message) ⇒ Object
- .table(header, data) ⇒ Object
Class Method Details
.ask(message, options = {}) ⇒ Object
6 7 8 |
# File 'lib/metanorma/cli/ui.rb', line 6 def self.ask(, = {}) new.ask(, ) end |
.debug(message, enabled: false) ⇒ Object
18 19 20 21 22 |
# File 'lib/metanorma/cli/ui.rb', line 18 def self.debug(, enabled: false) if enabled new.say(["[debug]", ].join(": ")) end end |
.error(message) ⇒ Object
24 25 26 |
# File 'lib/metanorma/cli/ui.rb', line 24 def self.error() new.error() end |
.info(message) ⇒ Object
14 15 16 |
# File 'lib/metanorma/cli/ui.rb', line 14 def self.info() new.say(["[info]", ].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() new.say() 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 |