summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-01-25 09:08:03 -0800
committerTim Smith <tsmith@chef.io>2019-01-25 09:08:03 -0800
commit8c3d5dbb7eb9903204e5e00d2a9f16c685993ddf (patch)
tree098c6f759b10c7382b627ad75baf05c83dbe9570
parent96d293d8635860ae92b15d527805e237842c4ab3 (diff)
downloadchef-8c3d5dbb7eb9903204e5e00d2a9f16c685993ddf.tar.gz
Misc YARD updates for knife
Some YARD fixes as I was reading through knife bits. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/formatters/indentable_output_stream.rb14
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb2
-rw-r--r--lib/chef/knife/core/generic_presenter.rb3
-rw-r--r--lib/chef/knife/core/node_presenter.rb3
-rw-r--r--lib/chef/knife/core/status_presenter.rb7
-rw-r--r--lib/chef/knife/core/ui.rb11
6 files changed, 29 insertions, 11 deletions
diff --git a/lib/chef/formatters/indentable_output_stream.rb b/lib/chef/formatters/indentable_output_stream.rb
index 7882527327..0481cb6217 100644
--- a/lib/chef/formatters/indentable_output_stream.rb
+++ b/lib/chef/formatters/indentable_output_stream.rb
@@ -24,9 +24,12 @@ class Chef
end
end
- # Print text. This will start a new line and indent if necessary
+ # Print text. This will start a new line and indent if necessary
# but will not terminate the line (future print and puts statements
# will start off where this print left off).
+ #
+ # @param string [String]
+ # @param args [Array<Hash,Symbol>]
def color(string, *args)
print(string, from_args(args))
end
@@ -34,18 +37,27 @@ class Chef
# Print the start of a new line. This will terminate any existing lines and
# cause indentation but will not move to the next line yet (future 'print'
# and 'puts' statements will stay on this line).
+ #
+ # @param string [String]
+ # @param args [Array<Hash,Symbol>]
def start_line(string, *args)
print(string, from_args(args, start_line: true))
end
# Print a line. This will continue from the last start_line or print,
# or start a new line and indent if necessary.
+ #
+ # @param string [String]
+ # @param args [Array<Hash,Symbol>]
def puts(string, *args)
print(string, from_args(args, end_line: true))
end
# Print an entire line from start to end. This will terminate any existing
# lines and cause indentation.
+ #
+ # @param string [String]
+ # @param args [Array<Hash,Symbol>]
def puts_line(string, *args)
print(string, from_args(args, start_line: true, end_line: true))
end
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index 5c736ab01b..bd094e5021 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -62,7 +62,7 @@ class Chef
end
# Contains commands and content, see trusted_certs_content
- # TODO: Rename to trusted_certs_script
+ # @todo Rename to trusted_certs_script
def trusted_certs
@trusted_certs ||= trusted_certs_content
end
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index 7b3fee00b5..8995f1f85d 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -25,7 +25,7 @@ class Chef
# Allows includer knife commands to return multiple attributes
# @brief knife node show NAME -a ATTR1 -a ATTR2
module MultiAttributeReturnOption
- # :nodoc:
+ # @private
def self.included(includer)
includer.class_eval do
option :field_separator,
@@ -45,7 +45,6 @@ class Chef
end
end
- #==Chef::Knife::Core::GenericPresenter
# The base presenter class for displaying structured data in knife commands.
# This is not an abstract base class, and it is suitable for displaying
# most kinds of objects that knife needs to display.
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index 5072cc4ae2..b46ff2ae77 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -26,7 +26,7 @@ class Chef
# This module may be included into a knife subcommand class to automatically
# add configuration options used by the NodePresenter
module NodeFormattingOptions
- # :nodoc:
+ # @private
# Would prefer to do this in a rational way, but can't be done b/c of
# Mixlib::CLI's design :(
def self.included(includer)
@@ -48,7 +48,6 @@ class Chef
end
end
- #==Chef::Knife::Core::NodePresenter
# A customized presenter for Chef::Node objects. Supports variable-length
# output formats for displaying node data
class NodePresenter < GenericPresenter
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index 5672124007..32ad6a13ae 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -26,7 +26,7 @@ class Chef
# This module may be included into a knife subcommand class to automatically
# add configuration options used by the StatusPresenter
module StatusFormattingOptions
- # :nodoc:
+ # @private
# Would prefer to do this in a rational way, but can't be done b/c of
# Mixlib::CLI's design :(
def self.included(includer)
@@ -48,7 +48,6 @@ class Chef
end
end
- #==Chef::Knife::Core::StatusPresenter
# A customized presenter for Chef::Node objects. Supports variable-length
# output formats for displaying node data
class StatusPresenter < GenericPresenter
@@ -148,8 +147,8 @@ class Chef
ui.color(key_text, :cyan)
end
- # :nodoc:
- # TODO: this is duplicated from StatusHelper in the Webui. dedup.
+ # @private
+ # @todo this is duplicated from StatusHelper in the Webui. dedup.
def time_difference_in_hms(unix_time)
now = Time.now.to_i
difference = now - unix_time.to_i
diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb
index b2efbd8b8f..3f0a697107 100644
--- a/lib/chef/knife/core/ui.rb
+++ b/lib/chef/knife/core/ui.rb
@@ -26,7 +26,6 @@ require "tempfile"
class Chef
class Knife
- #==Chef::Knife::UI
# The User Interaction class used by knife.
class UI
@@ -64,6 +63,8 @@ class Chef
# Prints a message to stdout. Aliased as +info+ for compatibility with
# the logger API.
+ #
+ # @param message [String] the text string
def msg(message)
stdout.puts message
rescue Errno::EPIPE => e
@@ -72,6 +73,8 @@ class Chef
end
# Prints a msg to stderr. Used for info, warn, error, and fatal.
+ #
+ # @param message [String] the text string
def log(message)
stderr.puts message
rescue Errno::EPIPE => e
@@ -83,16 +86,22 @@ class Chef
alias :err :log
# Print a warning message
+ #
+ # @param message [String] the text string
def warn(message)
log("#{color('WARNING:', :yellow, :bold)} #{message}")
end
# Print an error message
+ #
+ # @param message [String] the text string
def error(message)
log("#{color('ERROR:', :red, :bold)} #{message}")
end
# Print a message describing a fatal error.
+ #
+ # @param message [String] the text string
def fatal(message)
log("#{color('FATAL:', :red, :bold)} #{message}")
end