Class: GitlabCli::UI::Basic
Direct Known Subclasses
Instance Method Summary collapse
- #ask(message, opts = nil) ⇒ Object
-
#initialize ⇒ Basic
constructor
A new instance of Basic.
- #yes?(message, color = nil) ⇒ Boolean
Constructor Details
#initialize ⇒ Basic
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(, 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 end |
#yes?(message, color = nil) ⇒ Boolean
56 57 58 |
# File 'lib/gitlab_cli/ui.rb', line 56 def yes?(, color=nil) @shell.yes? , color end |