Class: CliUtil
- Inherits:
-
Object
- Object
- CliUtil
- Defined in:
- lib/yadecli/util/cli_util.rb
Overview
cli util
Class Method Summary collapse
- .check_root ⇒ Object
- .print_command_outcome(outcome) ⇒ Object
-
.print_header(title, subtitles) ⇒ Object
print header and subtitle(s).
Class Method Details
.check_root ⇒ Object
28 29 30 |
# File 'lib/yadecli/util/cli_util.rb', line 28 def check_root Process.uid.zero? end |
.print_command_outcome(outcome) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/yadecli/util/cli_util.rb', line 18 def print_command_outcome(outcome) if outcome.success? puts outcome.result.colorize(:color => :green, :mode => :bold) else outcome.errors..each do || puts .colorize(:color => :red, :mode => :bold) end end end |
.print_header(title, subtitles) ⇒ Object
print header and subtitle(s)
12 13 14 15 16 |
# File 'lib/yadecli/util/cli_util.rb', line 12 def print_header(title, subtitles) a = Artii::Base.new puts a.asciify(title).colorize(:color => :green, :mode => :bold) subtitles.each { |s| puts s.colorize(:cyan) } unless subtitles.nil? || subtitles.empty? end |