toys-core 0.3.7.1 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -2
- data/lib/toys-core.rb +23 -8
- data/lib/toys/cli.rb +62 -23
- data/lib/toys/core_version.rb +1 -1
- data/lib/toys/definition/arg.rb +0 -2
- data/lib/toys/definition/flag.rb +2 -4
- data/lib/toys/definition/tool.rb +38 -36
- data/lib/toys/dsl/arg.rb +4 -0
- data/lib/toys/dsl/flag.rb +9 -5
- data/lib/toys/dsl/tool.rb +35 -28
- data/lib/toys/input_file.rb +2 -1
- data/lib/toys/loader.rb +97 -51
- data/lib/toys/middleware.rb +61 -87
- data/lib/toys/runner.rb +19 -2
- data/lib/toys/{middleware → standard_middleware}/add_verbosity_flags.rb +24 -8
- data/lib/toys/{middleware → standard_middleware}/handle_usage_errors.rb +4 -6
- data/lib/toys/{middleware → standard_middleware}/set_default_descriptions.rb +4 -4
- data/lib/toys/{middleware → standard_middleware}/show_help.rb +32 -16
- data/lib/toys/{middleware → standard_middleware}/show_root_version.rb +4 -5
- data/lib/toys/{helpers → standard_mixins}/exec.rb +8 -8
- data/lib/toys/{helpers → standard_mixins}/fileutils.rb +1 -1
- data/lib/toys/{helpers → standard_mixins}/highline.rb +2 -3
- data/lib/toys/{helpers → standard_mixins}/terminal.rb +2 -4
- data/lib/toys/tool.rb +3 -2
- data/lib/toys/utils/exec.rb +255 -82
- data/lib/toys/utils/gems.rb +3 -3
- data/lib/toys/utils/help_text.rb +0 -2
- data/lib/toys/utils/module_lookup.rb +60 -40
- data/lib/toys/utils/wrappable_string.rb +0 -2
- metadata +11 -19
- data/lib/toys/helpers.rb +0 -54
- data/lib/toys/middleware/base.rb +0 -99
- data/lib/toys/templates.rb +0 -55
- data/lib/toys/templates/clean.rb +0 -85
- data/lib/toys/templates/gem_build.rb +0 -125
- data/lib/toys/templates/minitest.rb +0 -125
- data/lib/toys/templates/rubocop.rb +0 -86
- data/lib/toys/templates/yardoc.rb +0 -101
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbe7cd88d7c1eba9d74c0006bfe81372963949d969671ad3d13597b941525a3f
|
4
|
+
data.tar.gz: 5c567a9a61f747fd292339681d24d7bc56fa89859d9f60f6f0f6796665b93148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe5308be03b7d7348390caf05d6c6ba76503746133b45931b1b7c75c7b5095f03ca4ee88cefde3e0a46583901a66fa56bd5fb628c242c64d3abb854d3fb548c8
|
7
|
+
data.tar.gz: 9766792fef7ba0e77aa8e0254f222ea6f64238eaa3bdc1ed758faf8429105662be235014de8c375803a2da38fe2b0c3da1ae110e77a96d127e318f452f29453b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.3.8 / 2018-06-10
|
4
|
+
|
5
|
+
* CHANGED: Renamed helpers to mixins.
|
6
|
+
* CHANGED: ModuleLookup is now a customizable class and can have multiple sources.
|
7
|
+
* CHANGED: Moved the existing templates to the toys gem since they are rake replacements.
|
8
|
+
* CHANGED: Renamed :in_from, :out_to, and :err_to exec options to :in, :out, :err
|
9
|
+
* ADDED: CLI can now customize the standard mixins, templates, and middleware.
|
10
|
+
* IMPROVED: Exec raises an error if passed an unknown option.
|
11
|
+
* IMPROVED: Exec now accepts nearly all the same stream specifications as Process#spawn.
|
12
|
+
|
3
13
|
### 0.3.7.1 / 2018-05-30
|
4
14
|
|
5
15
|
* No changes.
|
data/README.md
CHANGED
@@ -19,8 +19,7 @@ highly experimental, and the code is evolving very rapidly. Please contact the
|
|
19
19
|
author before embarking on a major pull request. More detailed contribution
|
20
20
|
guidelines will be provided when the software stabilizes further.
|
21
21
|
|
22
|
-
The source can be found on Github at
|
23
|
-
[https://github.com/dazuma/toys](https://github.com/dazuma/toys)
|
22
|
+
The source can be found on Github at https://github.com/dazuma/toys
|
24
23
|
|
25
24
|
## License
|
26
25
|
|
data/lib/toys-core.rb
CHANGED
@@ -34,20 +34,31 @@
|
|
34
34
|
# individual directories.
|
35
35
|
#
|
36
36
|
module Toys
|
37
|
-
##
|
38
|
-
# Namespace for common utility classes.
|
39
|
-
#
|
40
|
-
module Utils; end
|
41
|
-
|
42
37
|
##
|
43
38
|
# Namespace for object definition classes.
|
44
39
|
#
|
45
40
|
module Definition; end
|
46
41
|
|
47
42
|
##
|
48
|
-
# Namespace for DSL classes.
|
43
|
+
# Namespace for DSL classes. These classes provide the directives that can be
|
44
|
+
# used in configuration files. Most are defined in {Toys::DSL::Tool}.
|
49
45
|
#
|
50
46
|
module DSL; end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Namespace for standard mixin classes.
|
50
|
+
#
|
51
|
+
module StandardMixins; end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Namespace for standard middleware classes.
|
55
|
+
#
|
56
|
+
module StandardMiddleware; end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Namespace for common utility classes.
|
60
|
+
#
|
61
|
+
module Utils; end
|
51
62
|
end
|
52
63
|
|
53
64
|
require "toys/cli"
|
@@ -61,11 +72,15 @@ require "toys/dsl/arg"
|
|
61
72
|
require "toys/dsl/flag"
|
62
73
|
require "toys/dsl/tool"
|
63
74
|
require "toys/errors"
|
64
|
-
require "toys/helpers"
|
65
75
|
require "toys/input_file"
|
66
76
|
require "toys/loader"
|
67
77
|
require "toys/middleware"
|
68
78
|
require "toys/runner"
|
69
79
|
require "toys/template"
|
70
|
-
require "toys/templates"
|
71
80
|
require "toys/tool"
|
81
|
+
require "toys/utils/exec"
|
82
|
+
require "toys/utils/gems"
|
83
|
+
require "toys/utils/help_text"
|
84
|
+
require "toys/utils/module_lookup"
|
85
|
+
require "toys/utils/terminal"
|
86
|
+
require "toys/utils/wrappable_string"
|
data/lib/toys/cli.rb
CHANGED
@@ -29,8 +29,6 @@
|
|
29
29
|
|
30
30
|
require "logger"
|
31
31
|
|
32
|
-
require "toys/utils/terminal"
|
33
|
-
|
34
32
|
module Toys
|
35
33
|
##
|
36
34
|
# A Toys-based CLI.
|
@@ -39,7 +37,7 @@ module Toys
|
|
39
37
|
#
|
40
38
|
class CLI
|
41
39
|
##
|
42
|
-
# Create a CLI
|
40
|
+
# Create a CLI.
|
43
41
|
#
|
44
42
|
# @param [String,nil] binary_name The binary name displayed in help text.
|
45
43
|
# Optional. Defaults to the ruby program name.
|
@@ -65,7 +63,17 @@ module Toys
|
|
65
63
|
# may use such a file to define auxiliary Ruby modules and classes that
|
66
64
|
# used by the tools defined in that directory.
|
67
65
|
# @param [Array] middleware_stack An array of middleware that will be used
|
68
|
-
# by default for all tools loaded by this CLI.
|
66
|
+
# by default for all tools loaded by this CLI. If not provided, uses
|
67
|
+
# {Toys::CLI.default_middleware_stack}.
|
68
|
+
# @param [Toys::Utils::ModuleLookup] mixin_lookup A lookup for well-known
|
69
|
+
# mixin modules. If not provided, uses
|
70
|
+
# {Toys::CLI.default_mixin_lookup}.
|
71
|
+
# @param [Toys::Utils::ModuleLookup] middleware_lookup A lookup for
|
72
|
+
# well-known middleware classes. If not provided, uses
|
73
|
+
# {Toys::CLI.default_middleware_lookup}.
|
74
|
+
# @param [Toys::Utils::ModuleLookup] template_lookup A lookup for
|
75
|
+
# well-known template classes. If not provided, uses
|
76
|
+
# {Toys::CLI.default_template_lookup}.
|
69
77
|
# @param [Logger,nil] logger The logger to use. If not provided, a default
|
70
78
|
# logger that writes to `STDERR` is used.
|
71
79
|
# @param [Integer,nil] base_level The logger level that should correspond
|
@@ -77,15 +85,11 @@ module Toys
|
|
77
85
|
# Default is a {Toys::CLI::DefaultErrorHandler} writing to the logger.
|
78
86
|
#
|
79
87
|
def initialize(
|
80
|
-
binary_name: nil,
|
81
|
-
config_dir_name: nil,
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
middleware_stack: nil,
|
86
|
-
logger: nil,
|
87
|
-
base_level: nil,
|
88
|
-
error_handler: nil
|
88
|
+
binary_name: nil, middleware_stack: nil,
|
89
|
+
config_dir_name: nil, config_file_name: nil,
|
90
|
+
index_file_name: nil, preload_file_name: nil,
|
91
|
+
mixin_lookup: nil, middleware_lookup: nil, template_lookup: nil,
|
92
|
+
logger: nil, base_level: nil, error_handler: nil
|
89
93
|
)
|
90
94
|
@logger = logger || self.class.default_logger
|
91
95
|
@base_level = base_level || @logger.level
|
@@ -95,10 +99,13 @@ module Toys
|
|
95
99
|
@config_file_name = config_file_name
|
96
100
|
@index_file_name = index_file_name
|
97
101
|
@preload_file_name = preload_file_name
|
102
|
+
@mixin_lookup = mixin_lookup || self.class.default_mixin_lookup
|
103
|
+
@middleware_lookup = middleware_lookup || self.class.default_middleware_lookup
|
104
|
+
@template_lookup = template_lookup || self.class.default_template_lookup
|
98
105
|
@loader = Loader.new(
|
99
|
-
index_file_name: index_file_name,
|
100
|
-
|
101
|
-
middleware_stack: @middleware_stack
|
106
|
+
index_file_name: index_file_name, preload_file_name: preload_file_name,
|
107
|
+
mixin_lookup: @mixin_lookup, template_lookup: @template_lookup,
|
108
|
+
middleware_lookup: @middleware_lookup, middleware_stack: @middleware_stack
|
102
109
|
)
|
103
110
|
@error_handler = error_handler || DefaultErrorHandler.new
|
104
111
|
end
|
@@ -236,6 +243,9 @@ module Toys
|
|
236
243
|
index_file_name: @index_file_name,
|
237
244
|
preload_file_name: @preload_file_name,
|
238
245
|
middleware_stack: @middleware_stack,
|
246
|
+
mixin_lookup: @mixin_lookup,
|
247
|
+
middleware_lookup: @middleware_lookup,
|
248
|
+
template_lookup: @template_lookup,
|
239
249
|
logger: @logger,
|
240
250
|
base_level: @base_level,
|
241
251
|
error_handler: @error_handler)
|
@@ -301,14 +311,14 @@ module Toys
|
|
301
311
|
# Returns a default set of middleware that may be used as a starting
|
302
312
|
# point for a typical CLI. This set includes the following in order:
|
303
313
|
#
|
304
|
-
# * {Toys::
|
305
|
-
# description fields
|
306
|
-
# * {Toys::
|
307
|
-
# * {Toys::
|
308
|
-
# * {Toys::
|
314
|
+
# * {Toys::StandardMiddleware::SetDefaultDescriptions} providing
|
315
|
+
# defaults for description fields
|
316
|
+
# * {Toys::StandardMiddleware::ShowHelp} adding the `--help` flag
|
317
|
+
# * {Toys::StandardMiddleware::HandleUsageErrors}
|
318
|
+
# * {Toys::StandardMiddleware::ShowHelp} providing default behavior for
|
309
319
|
# namespaces
|
310
|
-
# * {Toys::
|
311
|
-
# `--quiet` flags for managing the logger level
|
320
|
+
# * {Toys::StandardMiddleware::AddVerbosityFlags} adding the `--verbose`
|
321
|
+
# and `--quiet` flags for managing the logger level
|
312
322
|
#
|
313
323
|
# @return [Array]
|
314
324
|
#
|
@@ -322,6 +332,35 @@ module Toys
|
|
322
332
|
]
|
323
333
|
end
|
324
334
|
|
335
|
+
##
|
336
|
+
# Returns a default ModuleLookup for mixins that points at the
|
337
|
+
# StandardMixins module.
|
338
|
+
#
|
339
|
+
# @return [Toys::Utils::ModuleLookup]
|
340
|
+
#
|
341
|
+
def default_mixin_lookup
|
342
|
+
Utils::ModuleLookup.new.add_path("toys/standard_mixins")
|
343
|
+
end
|
344
|
+
|
345
|
+
##
|
346
|
+
# Returns a default ModuleLookup for middleware that points at the
|
347
|
+
# StandardMiddleware module.
|
348
|
+
#
|
349
|
+
# @return [Toys::Utils::ModuleLookup]
|
350
|
+
#
|
351
|
+
def default_middleware_lookup
|
352
|
+
Utils::ModuleLookup.new.add_path("toys/standard_middleware")
|
353
|
+
end
|
354
|
+
|
355
|
+
##
|
356
|
+
# Returns a default empty ModuleLookup for templates.
|
357
|
+
#
|
358
|
+
# @return [Toys::Utils::ModuleLookup]
|
359
|
+
#
|
360
|
+
def default_template_lookup
|
361
|
+
Utils::ModuleLookup.new
|
362
|
+
end
|
363
|
+
|
325
364
|
##
|
326
365
|
# Returns a default logger that logs to `$stderr`.
|
327
366
|
#
|
data/lib/toys/core_version.rb
CHANGED
data/lib/toys/definition/arg.rb
CHANGED
data/lib/toys/definition/flag.rb
CHANGED
@@ -27,10 +27,6 @@
|
|
27
27
|
# POSSIBILITY OF SUCH DAMAGE.
|
28
28
|
;
|
29
29
|
|
30
|
-
require "optparse"
|
31
|
-
|
32
|
-
require "toys/utils/wrappable_string"
|
33
|
-
|
34
30
|
module Toys
|
35
31
|
module Definition
|
36
32
|
##
|
@@ -55,6 +51,8 @@ module Toys
|
|
55
51
|
setup(str, [$1], $1, "--", nil, nil, nil, nil)
|
56
52
|
when /^(--\w[\?\w-]*)([= ])\[(\w+)\]$/
|
57
53
|
setup(str, [$1], $1, "--", :value, :optional, $2, $3)
|
54
|
+
when /^(--\w[\?\w-]*)\[([= ])(\w+)\]$/
|
55
|
+
setup(str, [$1], $1, "--", :value, :optional, $2, $3)
|
58
56
|
when /^(--\w[\?\w-]*)([= ])(\w+)$/
|
59
57
|
setup(str, [$1], $1, "--", :value, :required, $2, $3)
|
60
58
|
else
|
data/lib/toys/definition/tool.rb
CHANGED
@@ -29,8 +29,6 @@
|
|
29
29
|
|
30
30
|
require "optparse"
|
31
31
|
|
32
|
-
require "toys/utils/wrappable_string"
|
33
|
-
|
34
32
|
module Toys
|
35
33
|
module Definition
|
36
34
|
##
|
@@ -71,12 +69,12 @@ module Toys
|
|
71
69
|
@full_name = full_name.dup.freeze
|
72
70
|
@tool_class = DSL::Tool.new_class(@full_name, priority, loader)
|
73
71
|
@priority = priority
|
74
|
-
@middleware_stack =
|
72
|
+
@middleware_stack = middleware_stack
|
75
73
|
|
76
74
|
@source_path = nil
|
77
75
|
@definition_finished = false
|
78
76
|
|
79
|
-
@desc =
|
77
|
+
@desc = Utils::WrappableString.new("")
|
80
78
|
@long_desc = []
|
81
79
|
|
82
80
|
@default_data = {}
|
@@ -84,7 +82,7 @@ module Toys
|
|
84
82
|
OPTPARSER_ACCEPTORS.each { |a| @acceptors[a] = a }
|
85
83
|
@used_flags = []
|
86
84
|
|
87
|
-
@
|
85
|
+
@mixins = {}
|
88
86
|
|
89
87
|
@flag_definitions = []
|
90
88
|
@required_arg_definitions = []
|
@@ -253,7 +251,7 @@ module Toys
|
|
253
251
|
|
254
252
|
##
|
255
253
|
# Returns a list of all custom acceptors used by this tool.
|
256
|
-
# @return [Array<Toys::
|
254
|
+
# @return [Array<Toys::Definition::Acceptor>]
|
257
255
|
#
|
258
256
|
def custom_acceptors
|
259
257
|
result = []
|
@@ -267,21 +265,21 @@ module Toys
|
|
267
265
|
end
|
268
266
|
|
269
267
|
##
|
270
|
-
# Get the named
|
268
|
+
# Get the named mixin from this tool or its ancestors.
|
271
269
|
#
|
272
|
-
# @param [String] name The
|
273
|
-
# @return [Module,nil] The
|
270
|
+
# @param [String] name The mixin name
|
271
|
+
# @return [Module,nil] The mixin module, or `nil` if not found.
|
274
272
|
#
|
275
|
-
def
|
276
|
-
@
|
273
|
+
def resolve_mixin(name)
|
274
|
+
@mixins.fetch(name.to_s) { |k| @parent ? @parent.resolve_mixin(k) : nil }
|
277
275
|
end
|
278
276
|
|
279
277
|
##
|
280
|
-
# Include the given
|
278
|
+
# Include the given mixin in the tool class.
|
281
279
|
#
|
282
|
-
# @param [String,Symbol,Module] name The
|
280
|
+
# @param [String,Symbol,Module] name The mixin name or module
|
283
281
|
#
|
284
|
-
def
|
282
|
+
def include_mixin(name)
|
285
283
|
tool_class.include(name)
|
286
284
|
self
|
287
285
|
end
|
@@ -334,7 +332,7 @@ module Toys
|
|
334
332
|
# Add an acceptor to the tool. This acceptor may be refereneced by name
|
335
333
|
# when adding a flag or an arg.
|
336
334
|
#
|
337
|
-
# @param [Toys::
|
335
|
+
# @param [Toys::Definition::Acceptor] acceptor The acceptor to add.
|
338
336
|
#
|
339
337
|
def add_acceptor(acceptor)
|
340
338
|
@acceptors[acceptor.name] = acceptor
|
@@ -342,13 +340,13 @@ module Toys
|
|
342
340
|
end
|
343
341
|
|
344
342
|
##
|
345
|
-
# Add a named
|
343
|
+
# Add a named mixin module to this tool.
|
346
344
|
#
|
347
|
-
# @param [String] name The name of the
|
348
|
-
# @param [Module]
|
345
|
+
# @param [String] name The name of the mixin.
|
346
|
+
# @param [Module] mixin_module The mixin module.
|
349
347
|
#
|
350
|
-
def
|
351
|
-
@
|
348
|
+
def add_mixin(name, mixin_module)
|
349
|
+
@mixins[name.to_s] = mixin_module
|
352
350
|
self
|
353
351
|
end
|
354
352
|
|
@@ -376,11 +374,12 @@ module Toys
|
|
376
374
|
# requested that is already in use or marked as disabled. Default is
|
377
375
|
# true.
|
378
376
|
# @param [String,Array<String>,Toys::Utils::WrappableString] desc Short
|
379
|
-
# description for the flag. See {Toys::Tool#desc=} for a
|
380
|
-
# allowed formats. Defaults to the empty string.
|
377
|
+
# description for the flag. See {Toys::Definition::Tool#desc=} for a
|
378
|
+
# description of allowed formats. Defaults to the empty string.
|
381
379
|
# @param [Array<String,Array<String>,Toys::Utils::WrappableString>] long_desc
|
382
|
-
# Long description for the flag. See
|
383
|
-
# description of allowed
|
380
|
+
# Long description for the flag. See
|
381
|
+
# {Toys::Definition::Tool#long_desc=} for a description of allowed
|
382
|
+
# formats. Defaults to the empty array.
|
384
383
|
#
|
385
384
|
def add_flag(key, flags = [],
|
386
385
|
accept: nil, default: nil, handler: nil,
|
@@ -428,11 +427,12 @@ module Toys
|
|
428
427
|
# @param [String] display_name A name to use for display (in help text and
|
429
428
|
# error reports). Defaults to the key in upper case.
|
430
429
|
# @param [String,Array<String>,Toys::Utils::WrappableString] desc Short
|
431
|
-
# description for the
|
432
|
-
# allowed formats. Defaults to the empty string.
|
430
|
+
# description for the arg. See {Toys::Definition::Tool#desc=} for a
|
431
|
+
# description of allowed formats. Defaults to the empty string.
|
433
432
|
# @param [Array<String,Array<String>,Toys::Utils::WrappableString>] long_desc
|
434
|
-
# Long description for the
|
435
|
-
# description of allowed
|
433
|
+
# Long description for the arg. See
|
434
|
+
# {Toys::Definition::Tool#long_desc=} for a description of allowed
|
435
|
+
# formats. Defaults to the empty array.
|
436
436
|
#
|
437
437
|
def add_required_arg(key, accept: nil, display_name: nil, desc: nil, long_desc: nil)
|
438
438
|
check_definition_state
|
@@ -460,11 +460,12 @@ module Toys
|
|
460
460
|
# @param [String] display_name A name to use for display (in help text and
|
461
461
|
# error reports). Defaults to the key in upper case.
|
462
462
|
# @param [String,Array<String>,Toys::Utils::WrappableString] desc Short
|
463
|
-
# description for the
|
464
|
-
# allowed formats. Defaults to the empty string.
|
463
|
+
# description for the arg. See {Toys::Definition::Tool#desc=} for a
|
464
|
+
# description of allowed formats. Defaults to the empty string.
|
465
465
|
# @param [Array<String,Array<String>,Toys::Utils::WrappableString>] long_desc
|
466
|
-
# Long description for the
|
467
|
-
# description of allowed
|
466
|
+
# Long description for the arg. See
|
467
|
+
# {Toys::Definition::Tool#long_desc=} for a description of allowed
|
468
|
+
# formats. Defaults to the empty array.
|
468
469
|
#
|
469
470
|
def add_optional_arg(key, default: nil, accept: nil, display_name: nil,
|
470
471
|
desc: nil, long_desc: nil)
|
@@ -494,11 +495,12 @@ module Toys
|
|
494
495
|
# @param [String] display_name A name to use for display (in help text and
|
495
496
|
# error reports). Defaults to the key in upper case.
|
496
497
|
# @param [String,Array<String>,Toys::Utils::WrappableString] desc Short
|
497
|
-
# description for the
|
498
|
-
# allowed formats. Defaults to the empty string.
|
498
|
+
# description for the arg. See {Toys::Definition::Tool#desc=} for a
|
499
|
+
# description of allowed formats. Defaults to the empty string.
|
499
500
|
# @param [Array<String,Array<String>,Toys::Utils::WrappableString>] long_desc
|
500
|
-
# Long description for the
|
501
|
-
# description of allowed
|
501
|
+
# Long description for the arg. See
|
502
|
+
# {Toys::Definition::Tool#long_desc=} for a description of allowed
|
503
|
+
# formats. Defaults to the empty array.
|
502
504
|
#
|
503
505
|
def set_remaining_args(key, default: [], accept: nil, display_name: nil,
|
504
506
|
desc: nil, long_desc: nil)
|
data/lib/toys/dsl/arg.rb
CHANGED
@@ -33,6 +33,10 @@ module Toys
|
|
33
33
|
# DSL for an arg definition block. Lets you set arg attributes in a block
|
34
34
|
# instead of a long series of keyword arguments.
|
35
35
|
#
|
36
|
+
# These directives are available inside a block passed to
|
37
|
+
# {Toys::DSL::Tool#required_arg}, {Toys::DSL::Tool#optional_arg}, or
|
38
|
+
# {Toys::DSL::Tool#remaining_args}.
|
39
|
+
#
|
36
40
|
class Arg
|
37
41
|
## @private
|
38
42
|
def initialize(accept, default, display_name, desc, long_desc)
|