toys 0.17.1 → 0.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +3 -3
  4. data/core-docs/toys/acceptor.rb +474 -0
  5. data/core-docs/toys/arg_parser.rb +397 -0
  6. data/core-docs/toys/cli.rb +466 -0
  7. data/core-docs/toys/compat.rb +2 -0
  8. data/core-docs/toys/completion.rb +340 -0
  9. data/core-docs/toys/context.rb +386 -0
  10. data/core-docs/toys/core.rb +14 -0
  11. data/core-docs/toys/dsl/base.rb +56 -0
  12. data/core-docs/toys/dsl/flag.rb +287 -0
  13. data/core-docs/toys/dsl/flag_group.rb +270 -0
  14. data/core-docs/toys/dsl/internal.rb +4 -0
  15. data/core-docs/toys/dsl/positional_arg.rb +155 -0
  16. data/core-docs/toys/dsl/tool.rb +1663 -0
  17. data/core-docs/toys/errors.rb +126 -0
  18. data/core-docs/toys/flag.rb +563 -0
  19. data/core-docs/toys/flag_group.rb +186 -0
  20. data/core-docs/toys/input_file.rb +17 -0
  21. data/core-docs/toys/loader.rb +411 -0
  22. data/core-docs/toys/middleware.rb +336 -0
  23. data/core-docs/toys/mixin.rb +142 -0
  24. data/core-docs/toys/module_lookup.rb +75 -0
  25. data/core-docs/toys/positional_arg.rb +145 -0
  26. data/core-docs/toys/settings.rb +524 -0
  27. data/core-docs/toys/source_info.rb +321 -0
  28. data/core-docs/toys/standard_middleware/add_verbosity_flags.rb +49 -0
  29. data/core-docs/toys/standard_middleware/apply_config.rb +24 -0
  30. data/core-docs/toys/standard_middleware/handle_usage_errors.rb +33 -0
  31. data/core-docs/toys/standard_middleware/set_default_descriptions.rb +222 -0
  32. data/core-docs/toys/standard_middleware/show_help.rb +190 -0
  33. data/core-docs/toys/standard_middleware/show_root_version.rb +45 -0
  34. data/core-docs/toys/standard_mixins/bundler.rb +98 -0
  35. data/core-docs/toys/standard_mixins/exec.rb +711 -0
  36. data/core-docs/toys/standard_mixins/fileutils.rb +18 -0
  37. data/core-docs/toys/standard_mixins/gems.rb +74 -0
  38. data/core-docs/toys/standard_mixins/git_cache.rb +41 -0
  39. data/core-docs/toys/standard_mixins/highline.rb +133 -0
  40. data/core-docs/toys/standard_mixins/pager.rb +50 -0
  41. data/core-docs/toys/standard_mixins/terminal.rb +135 -0
  42. data/core-docs/toys/standard_mixins/xdg.rb +49 -0
  43. data/core-docs/toys/template.rb +112 -0
  44. data/core-docs/toys/tool_definition.rb +1080 -0
  45. data/core-docs/toys/utils/completion_engine.rb +49 -0
  46. data/core-docs/toys/utils/exec.rb +776 -0
  47. data/core-docs/toys/utils/gems.rb +185 -0
  48. data/core-docs/toys/utils/git_cache.rb +368 -0
  49. data/core-docs/toys/utils/help_text.rb +134 -0
  50. data/core-docs/toys/utils/pager.rb +118 -0
  51. data/core-docs/toys/utils/standard_ui.rb +184 -0
  52. data/core-docs/toys/utils/terminal.rb +310 -0
  53. data/core-docs/toys/utils/xdg.rb +253 -0
  54. data/core-docs/toys/wrappable_string.rb +132 -0
  55. data/core-docs/toys-core.rb +111 -0
  56. data/lib/toys/version.rb +1 -1
  57. metadata +57 -5
@@ -0,0 +1,321 @@
1
+ module Toys
2
+ ##
3
+ # **_Defined in the toys-core gem_**
4
+ #
5
+ # Information about the source of a tool, such as the file, git repository,
6
+ # or block that defined it.
7
+ #
8
+ # This object represents a source of tool information and definitions. Such a
9
+ # source could include:
10
+ #
11
+ # * A toys directory
12
+ # * A single toys file
13
+ # * A file or directory loaded from git
14
+ # * A file or directory loaded from a gem
15
+ # * A config block passed directly to the CLI
16
+ # * A tool block within a toys file
17
+ #
18
+ # The SourceInfo provides information such as the tool's context directory,
19
+ # and locates data and lib directories appropriate to the tool. It also
20
+ # locates the tool's source code so it can be reported when an error occurs.
21
+ #
22
+ # Each tool has a unique SourceInfo with all the information specific to that
23
+ # tool. Additionally, SourceInfo objects are arranged in a containment
24
+ # hierarchy. For example, a SourceInfo object representing a toys files could
25
+ # have a parent representing a toys directory, and an object representing a
26
+ # tool block could have a parent representing an enclosing block or a file.
27
+ #
28
+ # Child SourceInfo objects generally inherit some attributes of their parent.
29
+ # For example, the `.toys` directory in a project directory defines the
30
+ # context directory as that project directory. Then all tools defined under
31
+ # that directory will share that context directory, so all SourceInfo objects
32
+ # descending from that root will inherit that value (unless it's changed
33
+ # explicitly).
34
+ #
35
+ # SourceInfo objects can be obtained in the DSL from
36
+ # {Toys::DSL::Tool#source_info} or at runtime by getting the
37
+ # {Toys::Context::Key::TOOL_SOURCE} key. However, they are created internally
38
+ # by the Loader and should not be created manually.
39
+ #
40
+ class SourceInfo
41
+ ##
42
+ # The parent of this SourceInfo.
43
+ #
44
+ # @return [Toys::SourceInfo] The parent.
45
+ # @return [nil] if this SourceInfo is a root.
46
+ #
47
+ attr_reader :parent
48
+
49
+ ##
50
+ # The root ancestor of this SourceInfo. This generally represents a source
51
+ # that was added directly to a CLI in code.
52
+ #
53
+ # @return [Toys::SourceInfo] The root ancestor.
54
+ #
55
+ attr_reader :root
56
+
57
+ ##
58
+ # The priority of tools defined by this source. Higher values indicate a
59
+ # higher priority. Lower priority values could be negative.
60
+ #
61
+ # @return [Integer] The priority.
62
+ #
63
+ attr_reader :priority
64
+
65
+ ##
66
+ # The context directory path (normally the directory containing the
67
+ # toplevel toys file or directory).
68
+ #
69
+ # This is not affected by setting a custom context directory for a tool.
70
+ #
71
+ # @return [String] The context directory path.
72
+ # @return [nil] if there is no context directory (perhaps because the root
73
+ # source was a block)
74
+ #
75
+ attr_reader :context_directory
76
+
77
+ ##
78
+ # The source, which may be a path or a proc depending on the {#source_type}.
79
+ #
80
+ # @return [String] Path to the source file or directory.
81
+ # @return [Proc] The block serving as the source.
82
+ #
83
+ attr_reader :source
84
+
85
+ ##
86
+ # The type of source. This could be:
87
+ #
88
+ # * `:file`, representing a single toys file. The {#source} will be the
89
+ # filesystem path to that file.
90
+ # * `:directory`, representing a toys directory. The {#source} will be the
91
+ # filesystem path to that directory.
92
+ # * `:proc`, representing a proc, which could be a toplevel block added
93
+ # directly to a CLI, a `tool` block within a toys file, or a block within
94
+ # another block. The {#source} will be the proc itself.
95
+ #
96
+ # @return [:file,:directory,:proc]
97
+ #
98
+ attr_reader :source_type
99
+
100
+ ##
101
+ # The path of the current source file or directory.
102
+ #
103
+ # This could be set even if {#source_type} is `:proc`, if that proc is
104
+ # defined within a toys file. The only time this is not set is if the
105
+ # source is added directly to a CLI in a code block.
106
+ #
107
+ # @return [String] The source path
108
+ # @return [nil] if this source has no file system path.
109
+ #
110
+ attr_reader :source_path
111
+
112
+ ##
113
+ # The source proc. This is set if {#source_type} is `:proc`.
114
+ #
115
+ # @return [Proc] The source proc
116
+ # @return [nil] if this source has no proc.
117
+ #
118
+ attr_reader :source_proc
119
+
120
+ ##
121
+ # The git remote. This is set if the source, or one of its ancestors, comes
122
+ # from git.
123
+ #
124
+ # @return [String] The git remote
125
+ # @return [nil] if this source is not fron git.
126
+ #
127
+ attr_reader :git_remote
128
+
129
+ ##
130
+ # The git path. This is set if the source, or one of its ancestors, comes
131
+ # from git.
132
+ #
133
+ # @return [String] The git path. This could be the empty string.
134
+ # @return [nil] if this source is not fron git.
135
+ #
136
+ attr_reader :git_path
137
+
138
+ ##
139
+ # The git commit. This is set if the source, or one of its ancestors, comes
140
+ # from git.
141
+ #
142
+ # @return [String] The git commit.
143
+ # @return [nil] if this source is not fron git.
144
+ #
145
+ attr_reader :git_commit
146
+
147
+ ##
148
+ # The gem name. This is set if the source, or one of its ancestors, comes
149
+ # from a gem.
150
+ #
151
+ # @return [String] The gem name.
152
+ # @return [nil] if this source is not from a gem.
153
+ #
154
+ attr_reader :gem_name
155
+
156
+ ##
157
+ # The gem version. This is set if the source, or one of its ancestors,
158
+ # comes from a gem.
159
+ #
160
+ # @return [Gem::Version] The gem version.
161
+ # @return [nil] if this source is not from a gem.
162
+ #
163
+ attr_reader :gem_version
164
+
165
+ ##
166
+ # The path within the gem, including the toys root directory in the gem.
167
+ #
168
+ # @return [String] The path.
169
+ # @return [nil] if this source is not from a gem.
170
+ #
171
+ attr_reader :gem_path
172
+
173
+ ##
174
+ # A user-visible name of this source.
175
+ #
176
+ # @return [String]
177
+ #
178
+ attr_reader :source_name
179
+ alias to_s source_name
180
+
181
+ ##
182
+ # Locate the given data file or directory and return an absolute path.
183
+ #
184
+ # @param path [String] The relative path to find
185
+ # @param type [nil,:file,:directory] Type of file system object to find,
186
+ # or nil (the default) to return any type.
187
+ # @return [String] Absolute path of the resulting data.
188
+ # @return [nil] if the data was not found.
189
+ #
190
+ def find_data(path, type: nil)
191
+ # Source available in the toys-core gem
192
+ end
193
+
194
+ ##
195
+ # Apply all lib paths in order from high to low priority
196
+ #
197
+ # @return [self]
198
+ #
199
+ def apply_lib_paths
200
+ # Source available in the toys-core gem
201
+ end
202
+
203
+ ##
204
+ # Create a SourceInfo.
205
+ #
206
+ # @private This interface is internal and subject to change without warning.
207
+ #
208
+ def initialize(parent, priority, context_directory,
209
+ source_type, source_path, source_proc,
210
+ git_remote, git_path, git_commit, gem_name, gem_version, gem_path,
211
+ source_name, data_dir_name, lib_dir_name)
212
+ # Source available in the toys-core gem
213
+ end
214
+
215
+ ##
216
+ # Create a child SourceInfo relative to the parent path.
217
+ #
218
+ # @private This interface is internal and subject to change without warning.
219
+ #
220
+ def relative_child(filename, source_name: nil)
221
+ # Source available in the toys-core gem
222
+ end
223
+
224
+ ##
225
+ # Create a child SourceInfo with an absolute path.
226
+ #
227
+ # @private This interface is internal and subject to change without warning.
228
+ #
229
+ def absolute_child(child_path, source_name: nil)
230
+ # Source available in the toys-core gem
231
+ end
232
+
233
+ ##
234
+ # Create a child SourceInfo with a git source.
235
+ #
236
+ # @private This interface is internal and subject to change without warning.
237
+ #
238
+ def git_child(child_git_remote, child_git_path, child_git_commit, child_path, source_name: nil)
239
+ # Source available in the toys-core gem
240
+ end
241
+
242
+ ##
243
+ # Create a child SourceInfo with a gem source.
244
+ #
245
+ # @private This interface is internal and subject to change without warning.
246
+ #
247
+ def gem_child(child_gem_name, child_gem_version, child_gem_path, child_path, source_name: nil)
248
+ # Source available in the toys-core gem
249
+ end
250
+
251
+ ##
252
+ # Create a proc child SourceInfo
253
+ #
254
+ # @private This interface is internal and subject to change without warning.
255
+ #
256
+ def proc_child(child_proc, source_name: nil)
257
+ # Source available in the toys-core gem
258
+ end
259
+
260
+ ##
261
+ # Create a root source info for a file path.
262
+ #
263
+ # @private This interface is internal and subject to change without warning.
264
+ #
265
+ def self.create_path_root(source_path, priority,
266
+ context_directory: nil,
267
+ data_dir_name: nil,
268
+ lib_dir_name: nil,
269
+ source_name: nil)
270
+ # Source available in the toys-core gem
271
+ end
272
+
273
+ ##
274
+ # Create a root source info for a cached git repo.
275
+ #
276
+ # @private This interface is internal and subject to change without warning.
277
+ #
278
+ def self.create_git_root(git_remote, git_path, git_commit, source_path, priority,
279
+ context_directory: nil,
280
+ data_dir_name: nil,
281
+ lib_dir_name: nil,
282
+ source_name: nil)
283
+ # Source available in the toys-core gem
284
+ end
285
+
286
+ ##
287
+ # Create a root source info for a loaded gem.
288
+ #
289
+ # @private This interface is internal and subject to change without warning.
290
+ #
291
+ def self.create_gem_root(gem_name, gem_version, gem_path, source_path, priority,
292
+ context_directory: nil,
293
+ data_dir_name: nil,
294
+ lib_dir_name: nil,
295
+ source_name: nil)
296
+ # Source available in the toys-core gem
297
+ end
298
+
299
+ ##
300
+ # Create a root source info for a proc.
301
+ #
302
+ # @private This interface is internal and subject to change without warning.
303
+ #
304
+ def self.create_proc_root(source_proc, priority,
305
+ context_directory: nil,
306
+ data_dir_name: nil,
307
+ lib_dir_name: nil,
308
+ source_name: nil)
309
+ # Source available in the toys-core gem
310
+ end
311
+
312
+ ##
313
+ # Check a path and determine the canonical path and type.
314
+ #
315
+ # @private This interface is internal and subject to change without warning.
316
+ #
317
+ def self.check_path(path, lenient)
318
+ # Source available in the toys-core gem
319
+ end
320
+ end
321
+ end
@@ -0,0 +1,49 @@
1
+ module Toys
2
+ module StandardMiddleware
3
+ ##
4
+ # **_Defined in the toys-core gem_**
5
+ #
6
+ # A middleware that provides flags for editing the verbosity.
7
+ #
8
+ # This middleware adds `-v`, `--verbose`, `-q`, and `--quiet` flags, if
9
+ # not already defined by the tool. These flags affect the setting of
10
+ # {Toys::Context::Key::VERBOSITY}, and, thus, the logger level.
11
+ #
12
+ class AddVerbosityFlags
13
+ ##
14
+ # Default verbose flags
15
+ # @return [Array<String>]
16
+ #
17
+ DEFAULT_VERBOSE_FLAGS = ["-v", "--verbose"].freeze
18
+
19
+ ##
20
+ # Default quiet flags
21
+ # @return [Array<String>]
22
+ #
23
+ DEFAULT_QUIET_FLAGS = ["-q", "--quiet"].freeze
24
+
25
+ ##
26
+ # Create a AddVerbosityFlags middleware.
27
+ #
28
+ # @param verbose_flags [Boolean,Array<String>,Proc] Specify flags
29
+ # to increase verbosity. The value may be any of the following:
30
+ #
31
+ # * An array of flags that increase verbosity.
32
+ # * The `true` value to use {DEFAULT_VERBOSE_FLAGS}. (Default)
33
+ # * The `false` value to disable verbose flags.
34
+ # * A proc that takes a tool and returns any of the above.
35
+ #
36
+ # @param quiet_flags [Boolean,Array<String>,Proc] Specify flags
37
+ # to decrease verbosity. The value may be any of the following:
38
+ #
39
+ # * An array of flags that decrease verbosity.
40
+ # * The `true` value to use {DEFAULT_QUIET_FLAGS}. (Default)
41
+ # * The `false` value to disable quiet flags.
42
+ # * A proc that takes a tool and returns any of the above.
43
+ #
44
+ def initialize(verbose_flags: true, quiet_flags: true)
45
+ # Source available in the toys-core gem
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,24 @@
1
+ module Toys
2
+ module StandardMiddleware
3
+ ##
4
+ # **_Defined in the toys-core gem_**
5
+ #
6
+ # A middleware that applies the given block to all tool configurations.
7
+ #
8
+ class ApplyConfig
9
+ ##
10
+ # Create an ApplyConfig middleware
11
+ #
12
+ # @param parent_source [Toys::SourceInfo] The SourceInfo corresponding to
13
+ # the source where this block is provided, or `nil` (the default) if
14
+ # the block does not come from a Toys file.
15
+ # @param source_name [String] A user-visible name for the source, or
16
+ # `nil` to use the default.
17
+ # @param block [Proc] The configuration to apply.
18
+ #
19
+ def initialize(parent_source: nil, source_name: nil, &block)
20
+ # Source available in the toys-core gem
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,33 @@
1
+ module Toys
2
+ module StandardMiddleware
3
+ ##
4
+ # **_Defined in the toys-core gem_**
5
+ #
6
+ # This middleware handles the case of a usage error. If a usage error, such
7
+ # as an unrecognized flag or an unfulfilled required argument, is detected,
8
+ # this middleware intercepts execution and displays the error along with
9
+ # the short help string, and terminates execution with an error code.
10
+ #
11
+ class HandleUsageErrors
12
+ ##
13
+ # Exit code for usage error. (2 by convention)
14
+ # @return [Integer]
15
+ #
16
+ USAGE_ERROR_EXIT_CODE = 2
17
+
18
+ ##
19
+ # Create a HandleUsageErrors middleware.
20
+ #
21
+ # @param exit_code [Integer] The exit code to return if a usage error
22
+ # occurs. Default is {USAGE_ERROR_EXIT_CODE}.
23
+ # @param stream [IO] Output stream to write to. Default is stderr.
24
+ # @param styled_output [Boolean,nil] Cause the tool to display help text
25
+ # with ansi styles. If `nil`, display styles if the output stream is
26
+ # a tty. Default is `nil`.
27
+ #
28
+ def initialize(exit_code: nil, stream: $stderr, styled_output: nil)
29
+ # Source available in the toys-core gem
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,222 @@
1
+ module Toys
2
+ module StandardMiddleware
3
+ ##
4
+ # **_Defined in the toys-core gem_**
5
+ #
6
+ # This middleware sets default description fields for tools and command
7
+ # line arguments and flags that do not have them set otherwise.
8
+ #
9
+ # You can modify the static descriptions for tools, namespaces, and the
10
+ # root tool by passing parameters to this middleware. For finer control,
11
+ # you can override methods to modify the description generation logic.
12
+ #
13
+ class SetDefaultDescriptions
14
+ ##
15
+ # The default description for tools.
16
+ # @return [String]
17
+ #
18
+ DEFAULT_TOOL_DESC = "(No tool description available)"
19
+
20
+ ##
21
+ # The default description for delegating tools.
22
+ # @return [String]
23
+ #
24
+ DEFAULT_DELEGATE_DESC = '(Delegates to "%<target>s")'
25
+
26
+ ##
27
+ # The default description for namespaces.
28
+ # @return [String]
29
+ #
30
+ DEFAULT_NAMESPACE_DESC = "(A namespace of tools)"
31
+
32
+ ##
33
+ # The default description for the root tool.
34
+ # @return [String]
35
+ #
36
+ DEFAULT_ROOT_DESC = "Command line tool built using the toys-core gem."
37
+
38
+ ##
39
+ # The default long description for the root tool.
40
+ # @return [String]
41
+ #
42
+ DEFAULT_ROOT_LONG_DESC = [
43
+ "This command line tool was built using the toys-core gem. See" \
44
+ " https://dazuma.github.io/toys/gems/toys-core for more info.",
45
+ "To replace this message, set the description and long description" \
46
+ " of the root tool, or configure the SetDefaultDescriptions" \
47
+ " middleware.",
48
+ ].freeze
49
+
50
+ ##
51
+ # Create a SetDefaultDescriptions middleware given default descriptions.
52
+ #
53
+ # @param default_tool_desc [String,nil] The default short description for
54
+ # runnable tools, or `nil` not to set one. Defaults to
55
+ # {DEFAULT_TOOL_DESC}.
56
+ # @param default_tool_long_desc [Array<String>,nil] The default long
57
+ # description for runnable tools, or `nil` not to set one. Defaults
58
+ # to `nil`.
59
+ # @param default_namespace_desc [String,nil] The default short
60
+ # description for non-runnable tools, or `nil` not to set one.
61
+ # Defaults to {DEFAULT_TOOL_DESC}.
62
+ # @param default_namespace_long_desc [Array<String>,nil] The default long
63
+ # description for non-runnable tools, or `nil` not to set one.
64
+ # Defaults to `nil`.
65
+ # @param default_root_desc [String,nil] The default short description for
66
+ # the root tool, or `nil` not to set one. Defaults to
67
+ # {DEFAULT_ROOT_DESC}.
68
+ # @param default_root_long_desc [Array<String>,nil] The default long
69
+ # description for the root tool, or `nil` not to set one. Defaults to
70
+ # {DEFAULT_ROOT_LONG_DESC}.
71
+ # @param default_delegate_desc [String,nil] The default short description
72
+ # for delegate tools, or `nil` not to set one. May include an sprintf
73
+ # field for the `target` name. Defaults to {DEFAULT_DELEGATE_DESC}.
74
+ #
75
+ def initialize(default_tool_desc: DEFAULT_TOOL_DESC,
76
+ default_tool_long_desc: nil,
77
+ default_namespace_desc: DEFAULT_NAMESPACE_DESC,
78
+ default_namespace_long_desc: nil,
79
+ default_root_desc: DEFAULT_ROOT_DESC,
80
+ default_root_long_desc: DEFAULT_ROOT_LONG_DESC,
81
+ default_delegate_desc: DEFAULT_DELEGATE_DESC)
82
+ # Source available in the toys-core gem
83
+ end
84
+
85
+ protected
86
+
87
+ ##
88
+ # This method implements the logic for generating a tool description.
89
+ # By default, it uses the parameters given to the middleware object.
90
+ # Override this method to provide different logic.
91
+ #
92
+ # @param tool [Toys::ToolDefinition] The tool to document.
93
+ # @param data [Hash] Additional data that might be useful. Currently,
94
+ # the {Toys::Loader} is passed with key `:loader`. Future versions
95
+ # of Toys may provide additional information.
96
+ # @return [String,Array<String>,Toys::WrappableString] The default
97
+ # description. See {Toys::DSL::Tool#desc} for info on the format.
98
+ # @return [nil] if this middleware should not set the description.
99
+ #
100
+ def generate_tool_desc(tool, data)
101
+ # Source available in the toys-core gem
102
+ end
103
+
104
+ ##
105
+ # This method implements logic for generating a tool long description.
106
+ # By default, it uses the parameters given to the middleware object.
107
+ # Override this method to provide different logic.
108
+ #
109
+ # @param tool [Toys::ToolDefinition] The tool to document
110
+ # @param data [Hash] Additional data that might be useful. Currently,
111
+ # the {Toys::Loader} is passed with key `:loader`. Future versions of
112
+ # Toys may provide additional information.
113
+ # @return [Array<Toys::WrappableString,String,Array<String>>] The default
114
+ # long description. See {Toys::DSL::Tool#long_desc} for info on the
115
+ # format.
116
+ # @return [nil] if this middleware should not set the long description.
117
+ #
118
+ def generate_tool_long_desc(tool, data)
119
+ # Source available in the toys-core gem
120
+ end
121
+
122
+ ##
123
+ # This method implements the logic for generating a flag description.
124
+ # Override this method to provide different logic.
125
+ #
126
+ # @param flag [Toys::Flag] The flag to document
127
+ # @param data [Hash] Additional data that might be useful. Currently,
128
+ # the {Toys::ToolDefinition} is passed with key `:tool`. Future
129
+ # versions of Toys may provide additional information.
130
+ # @return [String,Array<String>,Toys::WrappableString] The default
131
+ # description. See {Toys::DSL::Tool#desc} for info on the format.
132
+ # @return [nil] if this middleware should not set the description.
133
+ #
134
+ def generate_flag_desc(flag, data)
135
+ # Source available in the toys-core gem
136
+ end
137
+
138
+ ##
139
+ # This method implements logic for generating a flag long description.
140
+ # Override this method to provide different logic.
141
+ #
142
+ # @param flag [Toys::Flag] The flag to document
143
+ # @param data [Hash] Additional data that might be useful. Currently,
144
+ # the {Toys::ToolDefinition} is passed with key `:tool`. Future
145
+ # versions of Toys may provide additional information.
146
+ # @return [Array<Toys::WrappableString,String,Array<String>>] The default
147
+ # long description. See {Toys::DSL::Tool#long_desc} for info on the
148
+ # format.
149
+ # @return [nil] if this middleware should not set the long description.
150
+ #
151
+ def generate_flag_long_desc(flag, data)
152
+ # Source available in the toys-core gem
153
+ end
154
+
155
+ ##
156
+ # This method implements the logic for generating an arg description.
157
+ # Override this method to provide different logic.
158
+ #
159
+ # @param arg [Toys::PositionalArg] The arg to document
160
+ # @param data [Hash] Additional data that might be useful. Currently,
161
+ # the {Toys::ToolDefinition} is passed with key `:tool`. Future
162
+ # versions of Toys may provide additional information.
163
+ # @return [String,Array<String>,Toys::WrappableString] The default
164
+ # description. See {Toys::DSL::Tool#desc} for info on the format.
165
+ # @return [nil] if this middleware should not set the description.
166
+ #
167
+ def generate_arg_desc(arg, data)
168
+ # Source available in the toys-core gem
169
+ end
170
+
171
+ ##
172
+ # This method implements logic for generating an arg long description.
173
+ # Override this method to provide different logic.
174
+ #
175
+ # @param arg [Toys::PositionalArg] The arg to document
176
+ # @param data [Hash] Additional data that might be useful. Currently,
177
+ # the {Toys::ToolDefinition} is passed with key `:tool`. Future
178
+ # versions of Toys may provide additional information.
179
+ # @return [Array<Toys::WrappableString,String,Array<String>>] The default
180
+ # long description. See {Toys::DSL::Tool#long_desc} for info on the
181
+ # format.
182
+ # @return [nil] if this middleware should not set the long description.
183
+ #
184
+ def generate_arg_long_desc(arg, data)
185
+ # Source available in the toys-core gem
186
+ end
187
+
188
+ ##
189
+ # This method implements the logic for generating a flag group
190
+ # description. Override this method to provide different logic.
191
+ #
192
+ # @param group [Toys::FlagGroup] The flag group to document
193
+ # @param data [Hash] Additional data that might be useful. Currently,
194
+ # the {Toys::ToolDefinition} is passed with key `:tool`. Future
195
+ # versions of Toys may provide additional information.
196
+ # @return [String,Array<String>,Toys::WrappableString] The default
197
+ # description. See {Toys::DSL::Tool#desc} for info on the format.
198
+ # @return [nil] if this middleware should not set the description.
199
+ #
200
+ def generate_flag_group_desc(group, data)
201
+ # Source available in the toys-core gem
202
+ end
203
+
204
+ ##
205
+ # This method implements the logic for generating a flag group long
206
+ # description. Override this method to provide different logic.
207
+ #
208
+ # @param group [Toys::FlagGroup] The flag group to document
209
+ # @param data [Hash] Additional data that might be useful. Currently,
210
+ # the {Toys::ToolDefinition} is passed with key `:tool`. Future
211
+ # versions of Toys may provide additional information.
212
+ # @return [Array<Toys::WrappableString,String,Array<String>>] The default
213
+ # long description. See {Toys::DSL::Tool#long_desc} for info on the
214
+ # format.
215
+ # @return [nil] if this middleware should not set the long description.
216
+ #
217
+ def generate_flag_group_long_desc(group, data)
218
+ # Source available in the toys-core gem
219
+ end
220
+ end
221
+ end
222
+ end