Module: TtyIntegration

Included in:
Config, Git, GitLab, GitLab::Issue, GitLab::MergeRequest, Menu, SFlow::SFlow
Defined in:
lib/tty_integration.rb

Instance Method Summary collapse

Instance Method Details

#bar(message = 'Realizando validações ') ⇒ Object



23
24
25
# File 'lib/tty_integration.rb', line 23

def bar(message = 'Realizando validações ')
  TTY::ProgressBar.new("#{message}[:bar]", incomplete: red, complete: green, total: 10)
end

#cmdObject



19
20
21
# File 'lib/tty_integration.rb', line 19

def cmd
  TTY::Command.new(printer: :null)
end

#error(message) ⇒ Object



35
36
37
# File 'lib/tty_integration.rb', line 35

def error(message)
  print TTY::Box.error(message, border: :light)
end

#greenObject



39
40
41
# File 'lib/tty_integration.rb', line 39

def green
  pastel.on_green(' ')
end

#pastelObject



15
16
17
# File 'lib/tty_integration.rb', line 15

def pastel
  Pastel.new
end

#promptObject



11
12
13
# File 'lib/tty_integration.rb', line 11

def prompt
  TTY::Prompt.new(track_history: true, interrupt: :exit)
end

#redObject



43
44
45
# File 'lib/tty_integration.rb', line 43

def red
  pastel.on_red(' ')
end

#success(message) ⇒ Object



31
32
33
# File 'lib/tty_integration.rb', line 31

def success(message)
  print TTY::Box.success(message, border: :light)
end

#tableObject



27
28
29
# File 'lib/tty_integration.rb', line 27

def table
  TTY::Table
end

#yellowObject



47
48
49
# File 'lib/tty_integration.rb', line 47

def yellow
  pastel.on_yellow(' ')
end