Module: DnsMadeEasy::CLI::MessageHelpers

Defined in:
lib/dnsmadeeasy/cli/message_helpers.rb

Overview

Convenience helpers for colorful boxed CLI status messages.

Constant Summary collapse

BOX_OPTIONS =
{
  border: { type: :thick },
  width: 85
}.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.stderrObject

Returns the value of attribute stderr.



15
16
17
# File 'lib/dnsmadeeasy/cli/message_helpers.rb', line 15

def stderr
  @stderr
end

.stdoutObject

Returns the value of attribute stdout.



15
16
17
# File 'lib/dnsmadeeasy/cli/message_helpers.rb', line 15

def stdout
  @stdout
end

Class Method Details

.error(message) ⇒ Object



26
27
28
# File 'lib/dnsmadeeasy/cli/message_helpers.rb', line 26

def error(message)
  print_to(stderr, TTY::Box.error(message, **BOX_OPTIONS))
end

.info(message) ⇒ Object



18
19
20
# File 'lib/dnsmadeeasy/cli/message_helpers.rb', line 18

def info(message)
  print_to(stdout, TTY::Box.info(message, **BOX_OPTIONS))
end

.success(message) ⇒ Object



30
31
32
# File 'lib/dnsmadeeasy/cli/message_helpers.rb', line 30

def success(message)
  print_to(stdout, TTY::Box.success(message, **BOX_OPTIONS))
end

.warn(message) ⇒ Object



22
23
24
# File 'lib/dnsmadeeasy/cli/message_helpers.rb', line 22

def warn(message)
  print_to(stderr, TTY::Box.warn(message, **BOX_OPTIONS))
end