Class: Dry::CLI::Help::Screens::Base
- Inherits:
-
Object
- Object
- Dry::CLI::Help::Screens::Base
- Defined in:
- lib/dry/cli/help/screens/base.rb
Overview
Renders the configured sections a screen supports, in configured
order, one blank line apart. A subclass lists the sections it
supports in SECTIONS and renders each in a private render_<name>
that returns lines, or nil when there is nothing to print.
Constant Summary collapse
- Row =
Formatter::Row
- INDENT =
Formatter::INDENT
- HELP =
Row.new(term: "-h, --help", text: "Show help", term_style: :option)
Instance Method Summary collapse
-
#initialize(config:, io:, terminal_width: Terminal.width) ⇒ Base
constructor
A new instance of Base.
- #render ⇒ String
Constructor Details
Instance Method Details
#render ⇒ String
26 27 28 29 30 31 32 33 |
# File 'lib/dry/cli/help/screens/base.rb', line 26 def render config.visible_sections .select { self.class::SECTIONS.include?(it) } .filter_map { send(:"render_#{it}") } .reject(&:empty?) .map { it.join("\n") } .join("\n\n") end |