class Cri::HelpRenderer

The {HelpRenderer} class is responsible for generating a string containing the help for a given command, intended to be printed on the command line.

Public Instance Methods

render() click to toggle source

@return [String] The help text for this command

# File lib/cri/help_renderer.rb, line 21
def render
  text = ''

  append_summary(text)
  append_usage(text)
  append_description(text)
  append_subcommands(text)
  append_options(text)

  text
end

Public Class Methods

new(cmd, params={}) click to toggle source

Creates a new help renderer for the given command.

@param [Cri::Command] cmd The command to generate the help for

@option params [Boolean] :verbose true if the help output should be

verbose, false otherwise.
# File lib/cri/help_renderer.rb, line 14
def initialize(cmd, params={})
  @cmd        = cmd
  @is_verbose = params.fetch(:verbose, false)
  @io         = params.fetch(:io, $stdout)
end