toys-core 0.10.4 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73bf616783bbde0d72f5f62c57437220208bb4e06d46feb6eeea4507aae386a6
4
- data.tar.gz: 3e526d1a50a7d03b8d42ef762b7bae02b5964efbc18a0b029dd39362876ff689
3
+ metadata.gz: 2345d22178ad2ca256a6099f3b359abaf6641248c3a29256000e40204c618802
4
+ data.tar.gz: e9874795dd5057d7eca70164f221ec923c0ac17862146f1a9f15cba3c1cfc4e8
5
5
  SHA512:
6
- metadata.gz: 90100efa91c07240449b8da3ce72c358c4e09766afa80bdae044e0769586a6c890815e4c71786526fa00851d2fbc32db82fec586b01bf0bf9877ab17fb7b2867
7
- data.tar.gz: f45936daa1ec21ee4d5531f5bda027a27cc45f4d99d678636d2c529fe1e0f1592130e5cddee5ffd25f8750487a92b8697f77f7a86d96f85cae63aa2840908f68
6
+ metadata.gz: 852717f2545a44143185d168c374d871ba9495ccece98161b880d8fdf75b0f5929a97998f3d193c700963717c406567f3f365d73f9c6ad5af13270317b2a5a74
7
+ data.tar.gz: 3c2bb70a9512f058a9ead3feb55c4c658f7ac3357c51f39c47cb9bef081c1c5f876d08f8f45a2d0d716e6a884d22b156c64664177306041e85e411a18075ebd0
@@ -1,23 +1,53 @@
1
1
  # Release History
2
2
 
3
- ### 0.10.4 / 2020-07-11
3
+ ### v0.11.3 / 2020-09-13
4
+
5
+ * FIXED: The Exec library recognizes the argv0 option, and logs it appropriately
6
+
7
+ ### v0.11.2 / 2020-09-06
8
+
9
+ * FIXED: Fix a JRuby-specific race condition when capturing exec streams
10
+
11
+ ### v0.11.1 / 2020-08-24
12
+
13
+ * DOCS: Minor documentation tweaks.
14
+
15
+ ### v0.11.0 / 2020-08-21
16
+
17
+ * ADDED: The load path can be truncated using the `truncate_load_path!` directive.
18
+ * IMPROVED: Generated help for delegates now includes the information for the target tool, plus subtools of the delegate.
19
+ * IMPROVED: The `:bundler` mixin searches for `gems.rb` and `.gems.rb` in addition to `Gemfile`.
20
+ * IMPROVED: The `:budnler` mixin can load a specific Gemfile path.
21
+ * FIXED: The loader can now find data and lib directories at the root level of a Toys directory.
22
+ * FIXED: Exec::Result correctly reports processes that terminated due to signals.
23
+ * FIXED: Fixed a rare Exec capture failure that resulted from a race condition when closing streams.
24
+
25
+ ### v0.10.5 / 2020-07-18
26
+
27
+ * IMPROVED: The bundler mixin silences bundler output during bundle setup.
28
+ * IMPROVED: The bundler mixin allows toys and toys-core to be in the Gemfile. It checks their version requirements against the running Toys version, and either adds the corret version to the bundle or raises IncompatibleToysError.
29
+ * IMPROVED: The bundler mixin automatically updates the bundle if install fails (typically because a transitive dependency has been explicitly updated.)
30
+ * FIXED: Some cases of transitive dependency handling by the bundler mixin.
31
+ * FIXED: Fixed a crash when computing suggestions, when running with a bundle on Ruby 2.6 or earlier.
32
+
33
+ ### v0.10.4 / 2020-07-11
4
34
 
5
35
  * IMPROVED: Bundler integration can now handle Toys itself being in the bundle, as long as the version requirements cover the running Toys version.
6
36
  * IMPROVED: Passing `static: true` to the `:bundler` mixin installs the bundle at definition rather than execution time.
7
37
 
8
- ### 0.10.3 / 2020-07-04
38
+ ### v0.10.3 / 2020-07-04
9
39
 
10
40
  * FIXED: The `exec_separate_tool` method in the `:exec` mixin no longer throws ENOEXEC on Windows.
11
41
 
12
- ### 0.10.2 / 2020-07-03
42
+ ### v0.10.2 / 2020-07-03
13
43
 
14
44
  * FIXED: The load path no longer loses the toys and toys-core directories after a bundle install.
15
45
 
16
- ### 0.10.1 / 2020-03-07
46
+ ### v0.10.1 / 2020-03-07
17
47
 
18
48
  * FIXED: Setting `:exit_on_nonzero_status` explicitly to false now works as expected.
19
49
 
20
- ### 0.10.0 / 2020-02-24
50
+ ### v0.10.0 / 2020-02-24
21
51
 
22
52
  Functional changes:
23
53
 
@@ -47,16 +77,16 @@ Internal interface changes:
47
77
  * CHANGED: `Toys::CLI.default_logger` removed and replaced with `Toys::CLI.default_logger_factory`. In general, global loggers for CLI are now discouraged because they are not thread-safe.
48
78
  * CHANGED: `Toys::Loader` uses an internal monitor rather than including `MonitorMixin`.
49
79
 
50
- ### 0.9.4 / 2020-01-26
80
+ ### v0.9.4 / 2020-01-26
51
81
 
52
82
  * FIXED: Crash in the loader when a non-ruby file appears in a toys directory
53
83
 
54
- ### 0.9.3 / 2020-01-05
84
+ ### v0.9.3 / 2020-01-05
55
85
 
56
86
  * FIXED: `delegate_to` directive could crash if an overriding tool has already been defined.
57
87
  * FIXED: A Ruby 2.7 warning when reporting a Toys file syntax error.
58
88
 
59
- ### 0.9.2 / 2020-01-03
89
+ ### v0.9.2 / 2020-01-03
60
90
 
61
91
  * IMPROVED: Mixins can now take real keyword arguments, and will pass them on properly to `on_initialize` and `on_include` blocks.
62
92
  * CHANGED: `Toys::Utils::Exec` and the `:exec` mixin methods now take real keyword arguments rather than an `opts` hash. This means you should use keywords (or the double-splat operator) to avoid a deprecation warning on Ruby 2.7.
@@ -64,11 +94,11 @@ Internal interface changes:
64
94
  * IMPROVED: `Toys::Loader` is now thread-safe. This means it is now possible for a single `Toys::CLI` to run multiple tools in different threads.
65
95
  * IMPROVED: There is now a class for middleware specs, making possible a nicer syntax for building a middleware stack.
66
96
 
67
- ### 0.9.1 / 2019-12-22
97
+ ### v0.9.1 / 2019-12-22
68
98
 
69
99
  * IMPROVED: `delegate_to` and `alias_tool` can take symbols as well as strings.
70
100
 
71
- ### 0.9.0 / 2019-12-02
101
+ ### v0.9.0 / 2019-12-02
72
102
 
73
103
  Functional changes:
74
104
 
@@ -91,12 +121,12 @@ Internal interface changes:
91
121
  * ADDED: `Toys::Tool#delegate_to` causes the tool to delegate to another tool.
92
122
  * ADDED: The `Toys::Context::Key::DELEGATED_FROM` key provides the delegating context, if any.
93
123
 
94
- ### 0.8.1 / 2019-11-19
124
+ ### v0.8.1 / 2019-11-19
95
125
 
96
126
  * FIXED: Listing subtools would crash if a broken alias was present.
97
127
  * DOCUMENTATION: Switched from redcarpet to kramdown, and tried to make some structural fixes.
98
128
 
99
- ### 0.8.0 / 2019-06-20
129
+ ### v0.8.0 / 2019-06-20
100
130
 
101
131
  This is a major update with significant new features and a bunch of fixes. It also includes a significant amount of internal reorganization and cleanup, some of which resulted in backward incompatible changes. Basic use should not be affected. All signifiant features planned for beta are now implemented.
102
132
 
@@ -195,17 +225,17 @@ Changes to internal interfaces:
195
225
  * ADDED: Range acceptor (`Acceptor::Range`) which validates against a range.
196
226
  * ADDED: Class methods `Acceptor.create` and `Acceptor.lookup_well_known`.
197
227
 
198
- ### 0.7.0 / 2019-01-23
228
+ ### v0.7.0 / 2019-01-23
199
229
 
200
230
  * ADDED: Flag groups, which enforce policies around which flags are required.
201
231
  * CHANGED: Flags within a group are sorted in help screens.
202
232
  * CHANGED: Canonical flag within a flag definition is now the first rather than the last.
203
233
 
204
- ### 0.6.1 / 2019-01-07
234
+ ### v0.6.1 / 2019-01-07
205
235
 
206
236
  * FIXED: The presence of aliases caused subtool listing to crash.
207
237
 
208
- ### 0.6.0 / 2018-10-22
238
+ ### v0.6.0 / 2018-10-22
209
239
 
210
240
  * CHANGED: Replaced Toys::Definition::DataFinder with Toys::Definition::SourceInfo.
211
241
  * CHANGED: Removed Toys::Definition#find_data. Use Toys::Definition#source_info and call find_data.
@@ -214,7 +244,7 @@ Changes to internal interfaces:
214
244
  from subtool lists.
215
245
  * IMPROVED: Optionally omit non-runnable namespaces from recursive subtool lists.
216
246
 
217
- ### 0.5.0 / 2018-10-07
247
+ ### v0.5.0 / 2018-10-07
218
248
 
219
249
  * FIXED: Template instantiation was failing if the hosting tool was priority-masked.
220
250
  * ADDED: Several additional characters can optionally be used as tool path delimiters.
@@ -224,31 +254,31 @@ Changes to internal interfaces:
224
254
  * IMPROVED: The tool directive can now take an array as the tool name.
225
255
  * IMPROVED: The tool directive can now take an `if_defined` argument.
226
256
 
227
- ### 0.4.5 / 2018-08-05
257
+ ### v0.4.5 / 2018-08-05
228
258
 
229
259
  * CHANGED: Dropped preload file feature
230
260
 
231
- ### 0.4.4 / 2018-07-21
261
+ ### v0.4.4 / 2018-07-21
232
262
 
233
263
  * FIXED: Utils::Exec wasn't closing streams after copying.
234
264
  * IMPROVED: Utils::Exec::Controller can capture or redirect the remainder of a controlled stream.
235
265
  * ADDED: Terminal#ask
236
266
 
237
- ### 0.4.3 / 2018-07-13
267
+ ### v0.4.3 / 2018-07-13
238
268
 
239
269
  * IMPROVED: Utils::Exec methods can now spawn subprocesses in the background
240
270
  * IMPROVED: Utils::Exec capture methods can now yield a controller
241
271
 
242
- ### 0.4.2 / 2018-07-08
272
+ ### v0.4.2 / 2018-07-08
243
273
 
244
274
  * FIXED: Raise an error rather than cause unexpected behavior if a mixin is included twice.
245
275
  * IMPROVED: The `include?` method extended to support mixin names in a tool dsl.
246
276
 
247
- ### 0.4.1 / 2018-07-03
277
+ ### v0.4.1 / 2018-07-03
248
278
 
249
279
  * FIXED: Terminal#confirm uppercased "N" for the wrong default.
250
280
 
251
- ### 0.4.0 / 2018-07-03
281
+ ### v0.4.0 / 2018-07-03
252
282
 
253
283
  Now declaring this alpha quality. Backward-incompatible changes are still
254
284
  possible from this point, but I'll try to avoid them.
@@ -260,13 +290,13 @@ possible from this point, but I'll try to avoid them.
260
290
  * IMPROVED: Utils::Gems installation is now much faster.
261
291
  * FIXED: Utils::Gems didn't reset the specifications on Ruby 2.3.
262
292
 
263
- ### 0.3.11 / 2018-07-02
293
+ ### v0.3.11 / 2018-07-02
264
294
 
265
295
  * CHANGED: Require Ruby 2.3 or later
266
296
  * CHANGED: Renamed "set" directive to "static" to reduce confusion with Tool#set.
267
297
  * ADDED: Convenience methods for getting option values
268
298
 
269
- ### 0.3.10 / 2018-06-30
299
+ ### v0.3.10 / 2018-06-30
270
300
 
271
301
  * CHANGED: Dropped Tool#option. Use Tool#get instead.
272
302
  * CHANGED: "run" directive renamed to "to_run"
@@ -275,11 +305,11 @@ possible from this point, but I'll try to avoid them.
275
305
  * ADDED: Mixins can provide initializers
276
306
  * ADDED: Loader can load an inline block
277
307
 
278
- ### 0.3.9.1 / 2018-06-24
308
+ ### v0.3.9.1 / 2018-06-24
279
309
 
280
310
  * FIXED: Built-in flags were interfering with disable_argument_parsing
281
311
 
282
- ### 0.3.9 / 2018-06-24
312
+ ### v0.3.9 / 2018-06-24
283
313
 
284
314
  * CHANGED: Cli#add_search_path_hierarchy changed the behavior of the base/terminate param
285
315
  * CHANGED: Removed alias_as directive since it's incompatible with selective loading.
@@ -288,7 +318,7 @@ possible from this point, but I'll try to avoid them.
288
318
  * ADDED: Exec#exec_proc and Exec#exec_tool that supports all the stream redirects
289
319
  * IMPROVED: Acceptors can be looked up recursively in the same way as mixins and templates
290
320
 
291
- ### 0.3.8 / 2018-06-10
321
+ ### v0.3.8 / 2018-06-10
292
322
 
293
323
  * CHANGED: Renamed helpers to mixins.
294
324
  * CHANGED: ModuleLookup is now a customizable class and can have multiple sources.
@@ -298,11 +328,11 @@ possible from this point, but I'll try to avoid them.
298
328
  * IMPROVED: Exec raises an error if passed an unknown option.
299
329
  * IMPROVED: Exec now accepts nearly all the same stream specifications as Process#spawn.
300
330
 
301
- ### 0.3.7.1 / 2018-05-30
331
+ ### v0.3.7.1 / 2018-05-30
302
332
 
303
333
  * No changes.
304
334
 
305
- ### 0.3.7 / 2018-05-30
335
+ ### v0.3.7 / 2018-05-30
306
336
 
307
337
  * CHANGED: Execution runs in the same scope as the DSL, which lets us use normal methods instead of helper-blocks.
308
338
  * CHANGED: Renamed "script" to "run", and allow setting of runnable by defining a "run" method
@@ -315,7 +345,7 @@ possible from this point, but I'll try to avoid them.
315
345
  * ADDED: Helper modules scoped to the tool hierarchy
316
346
  * ADDED: Utility that installs and activates third-party gems.
317
347
 
318
- ### 0.3.6 / 2018-05-21
348
+ ### v0.3.6 / 2018-05-21
319
349
 
320
350
  * CHANGED: Renamed show_version middleware to show_root_version.
321
351
  * CHANGED: Reworked set_default_descriptions interface for more flexibility.
@@ -327,14 +357,14 @@ possible from this point, but I'll try to avoid them.
327
357
  * IMPROVED: Support custom acceptors.
328
358
  * IMPROVED: Highline helper automatically sets use_color based on the type of stdout.
329
359
 
330
- ### 0.3.5 / 2018-05-15
360
+ ### v0.3.5 / 2018-05-15
331
361
 
332
362
  * CHANGED: Exec logic now lives in a utils class.
333
363
  * CHANGED: Moved flag and arg blocks from Tool into the DSL.
334
364
  * CHANGED: Renamed `execute do` to `script do`, and Tool#executor to Tool#script.
335
365
  * IMPROVED: Help display can use `less` if available.
336
366
 
337
- ### 0.3.4 / 2018-05-14
367
+ ### v0.3.4 / 2018-05-14
338
368
 
339
369
  * CHANGED: Renamed switch to flag
340
370
  * CHANGED: Renamed Utils::Usage to Utils::HelpText
@@ -356,7 +386,7 @@ possible from this point, but I'll try to avoid them.
356
386
  * ADDED: Alias DSL methods `required`, `optional`, and `remaining`.
357
387
  * FIXED: Finish definitions for subtools since the desc may depend on it
358
388
 
359
- ### 0.3.3 / 2018-05-09
389
+ ### v0.3.3 / 2018-05-09
360
390
 
361
391
  * CHANGED: Renamed file_utils helper to fileutils.
362
392
  * CHANGED: Renamed `doc:` parameter to `docs:`.
@@ -369,7 +399,7 @@ possible from this point, but I'll try to avoid them.
369
399
  * IMPROVED: Usage can now customize the left column width and indent
370
400
  * IMPROVED: Newlines in documentation are properly indented
371
401
 
372
- ### 0.3.2 / 2018-05-07
402
+ ### v0.3.2 / 2018-05-07
373
403
 
374
404
  * CHANGED: Split core engine out into "toys-core" from the "toys" gem.
375
405
  * CHANGED: Renamed path types to "search" and "config" paths, and restricted the former to the CLI.
data/README.md CHANGED
@@ -258,7 +258,7 @@ itself. However, the `toys-core` gem is a dependency, and your users will need
258
258
  to have it installed. You could alleviate this by wrapping your executable in a
259
259
  gem that can declare `toys-core` as a dependency explicitly.
260
260
 
261
- The [examples directory](https://github.com/dazuma/toys/tree/master/toys-core/examples)
261
+ The [examples directory](https://github.com/dazuma/toys/tree/main/toys-core/examples)
262
262
  includes a few simple examples that you can use as a starting point.
263
263
 
264
264
  To experiment with the examples, clone the Toys repo from GitHub:
@@ -272,7 +272,7 @@ Navigate to the simple-gem example:
272
272
 
273
273
  This example wraps the simple "greet" executable that we
274
274
  [covered earlier](#Add_some_functionality) in a gem. You can see the
275
- [executable file](https://github.com/dazuma/toys/tree/master/toys-core/examples/simple-gem/bin/toys-core-simple-example)
275
+ [executable file](https://github.com/dazuma/toys/tree/main/toys-core/examples/simple-gem/bin/toys-core-simple-example)
276
276
  in the bin directory.
277
277
 
278
278
  Try it out by building and installing the gem. From the `examples/simple-gem`
@@ -297,16 +297,16 @@ break it up into multiple files. The multi-file gem example demonstrates this.
297
297
  $ cd ../multi-file-gem
298
298
 
299
299
  This executable's implementation resides in its
300
- [lib directory](https://github.com/dazuma/toys/tree/master/toys-core/examples/multi-file-gem/lib),
300
+ [lib directory](https://github.com/dazuma/toys/tree/main/toys-core/examples/multi-file-gem/lib),
301
301
  a technique that may be familiar to writers of command line executables. More
302
302
  interestingly, the tools themselves are no longer defined in a block passed to
303
303
  the CLI object, but have been moved into a separate
304
- ["tools" directory](https://github.com/dazuma/toys/tree/master/toys-core/examples/multi-file-gem/tools).
304
+ ["tools" directory](https://github.com/dazuma/toys/tree/main/toys-core/examples/multi-file-gem/tools).
305
305
  This directory has the same structure and supports the same features that are
306
306
  available when writing complex sets of tools in a `.toys` directory. You then
307
307
  configure the CLI object to look in this directory for its tools definitions,
308
308
  as you can see in
309
- [the code](https://github.com/dazuma/toys/tree/master/toys-core/examples/multi-file-gem/lib/toys-core-multi-gem-example.rb).
309
+ [the code](https://github.com/dazuma/toys/tree/main/toys-core/examples/multi-file-gem/lib/toys-core-multi-gem-example.rb).
310
310
 
311
311
  Try it out now. From the `examples/multi-file-gem` directory, run:
312
312
 
@@ -1,4 +1,6 @@
1
+ <!--
1
2
  # @title Toys-Core User Guide
3
+ -->
2
4
 
3
5
  # Toys-Core User Guide
4
6
 
@@ -498,7 +498,7 @@ module Toys
498
498
  # well-known acceptor.
499
499
  #
500
500
  # @param spec [Object] See the description for recognized values.
501
- # @param options [Hash] Additional options to pass to the completion.
501
+ # @param options [Hash] Additional options to pass to the acceptor.
502
502
  # @param block [Proc] See the description for recognized forms.
503
503
  # @return [Toys::Acceptor::Base,Proc]
504
504
  #
@@ -33,7 +33,11 @@ module Toys
33
33
  require "did_you_mean"
34
34
  rescue ::LoadError
35
35
  require "rubygems"
36
- require "did_you_mean" rescue nil # rubocop:disable Style/RescueModifier
36
+ begin
37
+ require "did_you_mean"
38
+ rescue ::LoadError
39
+ # Oh well, it's not available
40
+ end
37
41
  end
38
42
  @supports_suggestions = defined?(::DidYouMean::SpellChecker)
39
43
  end
@@ -9,7 +9,7 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.10.4"
12
+ VERSION = "0.11.3"
13
13
  end
14
14
 
15
15
  ## @private deprecated
@@ -75,8 +75,8 @@ module Toys
75
75
  # string (e.g. `"foo"`) is taken as the value. Otherwise, the
76
76
  # following argument is taken as the value (e.g. for `--abc foo`, the
77
77
  # value is set to `"foo"`.) The following argument is treated as the
78
- # value even if it looks like a flag (e.g. `--abc --abc` causes the
79
- # string `"--abc"` to be taken as the value.)
78
+ # value even if it looks like a flag (e.g. `--abc --def` causes the
79
+ # string `"--def"` to be taken as the value.)
80
80
  # * `--abc[=VAL]` : A long flag that takes an optional value. If this
81
81
  # argument appears with a value attached (e.g. `--abc=foo`), the
82
82
  # attached string (e.g. `"foo"`) is taken as the value. Otherwise,
@@ -79,8 +79,8 @@ module Toys
79
79
  # string (e.g. `"foo"`) is taken as the value. Otherwise, the
80
80
  # following argument is taken as the value (e.g. for `--abc foo`, the
81
81
  # value is set to `"foo"`.) The following argument is treated as the
82
- # value even if it looks like a flag (e.g. `--abc --abc` causes the
83
- # string `"--abc"` to be taken as the value.)
82
+ # value even if it looks like a flag (e.g. `--abc --def` causes the
83
+ # string `"--def"` to be taken as the value.)
84
84
  # * `--abc[=VAL]` : A long flag that takes an optional value. If this
85
85
  # argument appears with a value attached (e.g. `--abc=foo`), the
86
86
  # attached string (e.g. `"foo"`) is taken as the value. Otherwise,
@@ -814,8 +814,8 @@ module Toys
814
814
  # string (e.g. `"foo"`) is taken as the value. Otherwise, the
815
815
  # following argument is taken as the value (e.g. for `--abc foo`, the
816
816
  # value is set to `"foo"`.) The following argument is treated as the
817
- # value even if it looks like a flag (e.g. `--abc --abc` causes the
818
- # string `"--abc"` to be taken as the value.)
817
+ # value even if it looks like a flag (e.g. `--abc --def` causes the
818
+ # string `"--def"` to be taken as the value.)
819
819
  # * `--abc[=VAL]` : A long flag that takes an optional value. If this
820
820
  # argument appears with a value attached (e.g. `--abc=foo`), the
821
821
  # attached string (e.g. `"foo"`) is taken as the value. Otherwise,
@@ -884,7 +884,8 @@ module Toys
884
884
  # @param flags [String...] The flags in OptionParser format.
885
885
  # @param accept [Object] An acceptor that validates and/or converts the
886
886
  # value. You may provide either the name of an acceptor you have
887
- # defined, or one of the default acceptors provided by OptionParser.
887
+ # defined, one of the default acceptors provided by OptionParser, or
888
+ # any other specification recognized by {Toys::Acceptor.create}.
888
889
  # Optional. If not specified, accepts any value as a string.
889
890
  # @param default [Object] The default value. This is the value that will
890
891
  # be set in the context if this flag is not provided on the command
@@ -979,7 +980,8 @@ module Toys
979
980
  # the execution context.
980
981
  # @param accept [Object] An acceptor that validates and/or converts the
981
982
  # value. You may provide either the name of an acceptor you have
982
- # defined, or one of the default acceptors provided by OptionParser.
983
+ # defined, one of the default acceptors provided by OptionParser, or
984
+ # any other specification recognized by {Toys::Acceptor.create}.
983
985
  # Optional. If not specified, accepts any value as a string.
984
986
  # @param complete [Object] A specifier for shell tab completion for
985
987
  # values of this arg. This is the empty completion by default. To
@@ -1050,7 +1052,8 @@ module Toys
1050
1052
  # line. Defaults to `nil`.
1051
1053
  # @param accept [Object] An acceptor that validates and/or converts the
1052
1054
  # value. You may provide either the name of an acceptor you have
1053
- # defined, or one of the default acceptors provided by OptionParser.
1055
+ # defined, one of the default acceptors provided by OptionParser, or
1056
+ # any other specification recognized by {Toys::Acceptor.create}.
1054
1057
  # Optional. If not specified, accepts any value as a string.
1055
1058
  # @param complete [Object] A specifier for shell tab completion for
1056
1059
  # values of this arg. This is the empty completion by default. To
@@ -1121,7 +1124,8 @@ module Toys
1121
1124
  # command line. Defaults to the empty array `[]`.
1122
1125
  # @param accept [Object] An acceptor that validates and/or converts the
1123
1126
  # value. You may provide either the name of an acceptor you have
1124
- # defined, or one of the default acceptors provided by OptionParser.
1127
+ # defined, one of the default acceptors provided by OptionParser, or
1128
+ # any other specification recognized by {Toys::Acceptor.create}.
1125
1129
  # Optional. If not specified, accepts any value as a string.
1126
1130
  # @param complete [Object] A specifier for shell tab completion for
1127
1131
  # values of this arg. This is the empty completion by default. To
@@ -1619,6 +1623,23 @@ module Toys
1619
1623
  self
1620
1624
  end
1621
1625
 
1626
+ ##
1627
+ # Remove lower-priority sources from the load path. This prevents lower-
1628
+ # priority sources (such as Toys files from parent or global directories)
1629
+ # from executing or defining tools.
1630
+ #
1631
+ # This works only if no such sources have already loaded yet.
1632
+ #
1633
+ # @raise [Toys::ToolDefinitionError] if any lower-priority tools have
1634
+ # already been loaded.
1635
+ #
1636
+ def truncate_load_path!
1637
+ unless @__loader.stop_loading_at_priority(@__priority)
1638
+ raise ToolDefinitionError,
1639
+ "Cannot truncate load path because tools have already been loaded"
1640
+ end
1641
+ end
1642
+
1622
1643
  ##
1623
1644
  # Determines whether the current Toys version satisfies the given
1624
1645
  # requirements.