Class: GitlabCli::UI::Basic

Inherits:
Interface show all
Defined in:
lib/gitlab_cli/ui.rb

Direct Known Subclasses

Color

Instance Method Summary collapse

Constructor Details

#initializeBasic

Returns a new instance of Basic.



18
19
20
21
22
# File 'lib/gitlab_cli/ui.rb', line 18

def initialize
  #super
  
  @shell = Thor::Shell::Basic.new
end

Instance Method Details

#ask(message, opts = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/gitlab_cli/ui.rb', line 36

def ask(message, opts=nil)
  #super(message)

  # We can't ask questions when the output isn't a TTY.
  #raise Errors::UIExpectsTTY if !$stdin.tty? && !Vagrant::Util::Platform.cygwin?

  # Setup the options so that the new line is suppressed
  #opts ||= {}
  #opts[:new_line] = false if !opts.has_key?(:new_line)
  #opts[:prefix]   = false if !opts.has_key?(:prefix)

  # Output the data
  #@shell.ask(:info, message, opts)

  # Get the results and chomp off the newline. We do a logical OR
  # here because `gets` can return a nil, for example in the case
  # that ctrl-D is pressed on the input.
  @shell.ask message
end

#yes?(message, color = nil) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/gitlab_cli/ui.rb', line 56

def yes?(message, color=nil)
  @shell.yes? message, color
end