Class: Veewee::UI::Shell

Inherits:
Veewee::UI show all
Defined in:
lib/veewee/ui.rb

Overview

A shell UI, which uses a `Thor::Shell` object to talk with a terminal.

Instance Attribute Summary

Attributes inherited from Veewee::UI

#env, #resource

Instance Method Summary collapse

Constructor Details

#initialize(env, shell) ⇒ Shell

Returns a new instance of Shell


31
32
33
34
35
# File 'lib/veewee/ui.rb', line 31

def initialize(env, shell)
  super(env)

  @shell = shell
end

Instance Method Details

#clear_lineObject


66
67
68
# File 'lib/veewee/ui.rb', line 66

def clear_line
  @shell.say(line_reset, nil, false)
end

#report_progress(progress, total, show_parts = true) ⇒ Object


58
59
60
61
62
63
64
# File 'lib/veewee/ui.rb', line 58

def report_progress(progress, total, show_parts = true)
  percent = (progress.to_f / total.to_f) * 100
  line = "Progress: #{percent.to_i}%"
  line << " (#{progress} / #{total})" if show_parts

  @shell.say(line, nil, false)
end