Class: Mccloud::UI::Shell

Inherits:
Mccloud::UI show all
Defined in:
lib/mccloud/ui.rb

Overview

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

Instance Attribute Summary

Attributes inherited from Mccloud::UI

#env

Instance Method Summary collapse

Constructor Details

#initialize(env, shell) ⇒ Shell

Returns a new instance of Shell.



27
28
29
30
31
# File 'lib/mccloud/ui.rb', line 27

def initialize(env, shell)
  super(env)

  @shell = shell
end

Instance Method Details

#clear_lineObject



62
63
64
# File 'lib/mccloud/ui.rb', line 62

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

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



54
55
56
57
58
59
60
# File 'lib/mccloud/ui.rb', line 54

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