Class: Toys::Utils::HelpText
- Inherits:
-
Object
- Object
- Toys::Utils::HelpText
- Defined in:
- core-docs/toys/utils/help_text.rb
Overview
Defined in the toys-core gem
A helper class that generates usage documentation for a tool.
This class generates full usage documentation, including description, flags, and arguments. It is used by middleware that implements help and related options.
This class is not loaded by default. Before using it directly, you should
require "toys/utils/help_text"
Defined Under Namespace
Classes: HelpGenerationError
Constant Summary collapse
- DEFAULT_LEFT_COLUMN_WIDTH =
Default width of first column
32- DEFAULT_INDENT =
Default indent
4
Instance Attribute Summary collapse
-
#tool ⇒ Toys::ToolDefinition
readonly
The ToolDefinition being documented.
Class Method Summary collapse
-
.from_context(context) ⇒ Toys::Utils::HelpText
Create a usage helper given an execution context.
Instance Method Summary collapse
-
#help_string(recursive: false, search: nil, include_hidden: false, show_source_path: false, separate_sources: false, indent: nil, indent2: nil, wrap_width: nil, styled: true) ⇒ String
Generate a long help string.
-
#initialize(tool, loader, executable_name, delegates: []) ⇒ Toys::Utils::HelpText
constructor
Create a usage helper.
-
#list_string(recursive: false, search: nil, include_hidden: false, separate_sources: false, indent: nil, wrap_width: nil, styled: true) ⇒ String
Generate a subtool list string.
-
#usage_string(recursive: false, include_hidden: false, separate_sources: false, left_column_width: nil, indent: nil, wrap_width: nil) ⇒ String
Generate a short usage string.
Constructor Details
#initialize(tool, loader, executable_name, delegates: []) ⇒ Toys::Utils::HelpText
Create a usage helper.
59 60 61 |
# File 'core-docs/toys/utils/help_text.rb', line 59 def initialize(tool, loader, executable_name, delegates: []) # Source available in the toys-core gem end |
Instance Attribute Details
#tool ⇒ Toys::ToolDefinition (readonly)
The ToolDefinition being documented.
67 68 69 |
# File 'core-docs/toys/utils/help_text.rb', line 67 def tool @tool end |
Class Method Details
.from_context(context) ⇒ Toys::Utils::HelpText
Create a usage helper given an execution context.
43 44 45 |
# File 'core-docs/toys/utils/help_text.rb', line 43 def self.from_context(context) # Source available in the toys-core gem end |
Instance Method Details
#help_string(recursive: false, search: nil, include_hidden: false, show_source_path: false, separate_sources: false, indent: nil, indent2: nil, wrap_width: nil, styled: true) ⇒ String
Generate a long help string.
113 114 115 116 117 |
# File 'core-docs/toys/utils/help_text.rb', line 113 def help_string(recursive: false, search: nil, include_hidden: false, show_source_path: false, separate_sources: false, indent: nil, indent2: nil, wrap_width: nil, styled: true) # Source available in the toys-core gem end |
#list_string(recursive: false, search: nil, include_hidden: false, separate_sources: false, indent: nil, wrap_width: nil, styled: true) ⇒ String
Generate a subtool list string.
137 138 139 140 |
# File 'core-docs/toys/utils/help_text.rb', line 137 def list_string(recursive: false, search: nil, include_hidden: false, separate_sources: false, indent: nil, wrap_width: nil, styled: true) # Source available in the toys-core gem end |
#usage_string(recursive: false, include_hidden: false, separate_sources: false, left_column_width: nil, indent: nil, wrap_width: nil) ⇒ String
Generate a short usage string.
86 87 88 89 |
# File 'core-docs/toys/utils/help_text.rb', line 86 def usage_string(recursive: false, include_hidden: false, separate_sources: false, left_column_width: nil, indent: nil, wrap_width: nil) # Source available in the toys-core gem end |