Module: Picobox::Utils::Output

Included in:
Box, CLI, Handlers::StdoutHandler, Project, Service, Services::Installer, System
Defined in:
lib/picobox/utils/output.rb

Instance Method Summary collapse

Instance Method Details

#display_error(e) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/picobox/utils/output.rb', line 20

def display_error(e)
  case e
  when Errors::ProjectNotInitialized
    display_project_not_initialized
  when Errors::DockerError
    display_docker_error
  when Errors::SystemDownError
    display_system_down
  when Errors::ShellNotSupported
    display_shell_not_supported e.message
  when Errors::DistroNotSupported
    display_distro_not_supported
  when Errors::PicoboxNotInstalled
    display_picobox_not_installed
  when Errors::ServiceNotImplemented
    display_service_not_available e.message
  when Picobox::Errors::FileNotFoundError
    display_file_not_found e.message
  else
    display_info(e, :red)
  end
end

#display_info(info, color = nil) ⇒ Object



9
10
11
# File 'lib/picobox/utils/output.rb', line 9

def display_info(info, color=nil)
  thor.say "  #{info}", color
end

#display_line(line) ⇒ Object



4
5
6
# File 'lib/picobox/utils/output.rb', line 4

def display_line(line)
  thor.say line
end

#display_status(status, line, log_status = true) ⇒ Object



14
15
16
17
# File 'lib/picobox/utils/output.rb', line 14

def display_status(status, line, log_status=true)
  return if line.nil? || line.strip == ""
  thor.say_status status, line, log_status
end