Class: GithubCLI::UI

Inherits:
Object
  • Object
show all
Defined in:
lib/github_cli/ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell) ⇒ UI

Returns a new instance of UI.



7
8
9
10
11
# File 'lib/github_cli/ui.rb', line 7

def initialize(shell)
  @shell = shell
  @quite = false
  @debug = ENV['DEBUG']
end

Instance Attribute Details

#shell=(value) ⇒ Object (writeonly)

Sets the attribute shell

Parameters:

  • value

    the value to set the attribute shell to.



5
6
7
# File 'lib/github_cli/ui.rb', line 5

def shell=(value)
  @shell = value
end

Instance Method Details

#confirm(message, newline = nil) ⇒ Object



13
14
15
# File 'lib/github_cli/ui.rb', line 13

def confirm(message, newline=nil)
  @shell.say message, :green, newline
end

#debug(message, newline = nil) ⇒ Object



29
30
31
# File 'lib/github_cli/ui.rb', line 29

def debug(message, newline=nil)
  @shell.say message, nil, newline
end

#debug!Object



37
38
39
# File 'lib/github_cli/ui.rb', line 37

def debug!
  @debug = true
end

#error(message, newline = nil) ⇒ Object



25
26
27
# File 'lib/github_cli/ui.rb', line 25

def error(message, newline=nil)
  @shell.say message, :red, newline
end

#info(message, newline = nil) ⇒ Object



17
18
19
# File 'lib/github_cli/ui.rb', line 17

def info(message, newline=nil)
  @shell.say message, nil, newline
end


41
42
43
# File 'lib/github_cli/ui.rb', line 41

def print_table(table, options={})
  @shell.print_table table, options
end


45
46
47
# File 'lib/github_cli/ui.rb', line 45

def print_wrapped(message, options={})
  @shell.print_wrapped message, options
end

#quite!Object



33
34
35
# File 'lib/github_cli/ui.rb', line 33

def quite!
  @quite = true
end

#terminal_widthObject



49
50
51
# File 'lib/github_cli/ui.rb', line 49

def terminal_width
  @shell.terminal_width
end

#warn(message, newline = nil) ⇒ Object



21
22
23
# File 'lib/github_cli/ui.rb', line 21

def warn(message, newline=nil)
  @shell.say message, :yellow, newline
end