Class: Toys::StandardMiddleware::SetDefaultDescriptions
- Inherits:
-
Object
- Object
- Toys::StandardMiddleware::SetDefaultDescriptions
- Defined in:
- lib/toys/standard_middleware/set_default_descriptions.rb
Overview
This middleware sets default description fields for tools and command line arguments and flags that do not have them set otherwise.
You can modify the static descriptions for tools, namespaces, and the root tool by passing parameters to this middleware. For finer control, you can override methods to modify the description generation logic.
Constant Summary collapse
- DEFAULT_TOOL_DESC =
The default description for tools.
"(No tool description available)"
- DEFAULT_DELEGATE_DESC =
The default description for delegating tools.
'(Delegates to "%<target>s")'
- DEFAULT_NAMESPACE_DESC =
The default description for namespaces.
"(A namespace of tools)"
- DEFAULT_ROOT_DESC =
The default description for the root tool.
"Command line tool built using the toys-core gem."
- DEFAULT_ROOT_LONG_DESC =
The default long description for the root tool.
[ "This command line tool was built using the toys-core gem. See" \ " https://dazuma.github.io/toys/gems/toys-core for more info.", "To replace this message, set the description and long description" \ " of the root tool, or configure the SetDefaultDescriptions" \ " middleware.", ].freeze
Instance Method Summary collapse
-
#initialize(default_tool_desc: DEFAULT_TOOL_DESC, default_tool_long_desc: nil, default_namespace_desc: DEFAULT_NAMESPACE_DESC, default_namespace_long_desc: nil, default_root_desc: DEFAULT_ROOT_DESC, default_root_long_desc: DEFAULT_ROOT_LONG_DESC, default_delegate_desc: DEFAULT_DELEGATE_DESC) ⇒ SetDefaultDescriptions
constructor
Create a SetDefaultDescriptions middleware given default descriptions.
Constructor Details
#initialize(default_tool_desc: DEFAULT_TOOL_DESC, default_tool_long_desc: nil, default_namespace_desc: DEFAULT_NAMESPACE_DESC, default_namespace_long_desc: nil, default_root_desc: DEFAULT_ROOT_DESC, default_root_long_desc: DEFAULT_ROOT_LONG_DESC, default_delegate_desc: DEFAULT_DELEGATE_DESC) ⇒ SetDefaultDescriptions
Create a SetDefaultDescriptions middleware given default descriptions.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/toys/standard_middleware/set_default_descriptions.rb', line 75 def initialize(default_tool_desc: DEFAULT_TOOL_DESC, default_tool_long_desc: nil, default_namespace_desc: DEFAULT_NAMESPACE_DESC, default_namespace_long_desc: nil, default_root_desc: DEFAULT_ROOT_DESC, default_root_long_desc: DEFAULT_ROOT_LONG_DESC, default_delegate_desc: DEFAULT_DELEGATE_DESC) @default_tool_desc = default_tool_desc @default_tool_long_desc = default_tool_long_desc @default_namespace_desc = default_namespace_desc @default_namespace_long_desc = default_namespace_long_desc @default_root_desc = default_root_desc @default_root_long_desc = default_root_long_desc @default_delegate_desc = default_delegate_desc end |