Class | Chef::Knife::UI
In: | lib/chef/knife/core/ui.rb
Parent: | Object

## Chef::Knife::UI

     The User Interaction class used by knife.

### Methods

ask ask_question color color? confirm edit_data edit_object err error fatal highline info interchange? list msg new output pretty_print use_presenter warn

### Attributes

config | [R] |
stderr | [R] |
stdin | [R] |
stdout | [R] |

### Public Class methods

new(stdout, stderr, stdin, config)

### Public Instance methods

ask(*args, &block)
ask_question(question, opts={})
color(string, *colors)
color?()

Should colored output be used? For output to a terminal, this is determined by the value of `config[:color]`. When output is not to a terminal, colored output is never used

confirm(question, append_instructions=true)
edit_data(data, parse_output=true)
edit_object(klass, name)
err(message)

Prints a msg to stderr. Used for warn, error, and fatal.

error(message)

Print an error message

fatal(message)

Print a message describing a fatal error.

highline()
info(message)

Alias for msg

interchange?()

Determines if the output format is a data interchange format, i.e., JSON or YAML

list(*args)
msg(message)

Prints a message to stdout. Aliased as `info` for compatibility with the logger API.

output(data)

Formats `data` using the configured presenter and outputs the result via `msg`. Formatting can be customized by configuring a different presenter. See `use_presenter`

pretty_print(data)
use_presenter(presenter_class)

Creates a new `presenter_class` object and uses it to format structured data for display. By default, a Chef::Knife::Core::GenericPresenter object is used.

warn(message)

Print a warning message

[Validate]