gli 2.17.0 → 2.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/gli/command.rb +10 -2
- data/lib/gli/version.rb +1 -1
- data/test/tc_command.rb +16 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a448f8a1c652b6ad37a81580150ffed9ac987cc
|
4
|
+
data.tar.gz: 8f56c2d35469a6a256d9d47742a7cc5bb0328570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 792cb23e23fdcc8eccb0397bc3ee194c57f4512f40d2bf9b1ca078579aef3522d5759c19d948a101eec6df8fc464d19307ed0a2c5f557d85616ce052f395ef4b
|
7
|
+
data.tar.gz: 9a60484551e346cf98c32b786d7955211125bc936cfd131e57ccd828cecb13613b82a53b9d08a1e1e3edcfbd78ff7ee9452d92d00dcbcaa31b0c755901023552
|
data/.gitignore
CHANGED
data/lib/gli/command.rb
CHANGED
@@ -30,8 +30,16 @@ module GLI
|
|
30
30
|
include DSL
|
31
31
|
include CommandSupport
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
class ParentKey
|
34
|
+
def to_sym
|
35
|
+
"__parent__".to_sym
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Key in an options hash to find the parent's parsed options. Note that if you are
|
40
|
+
# using openstruct, e.g. via `use_openstruct true` in your app setup, you will need
|
41
|
+
# to use the method `__parent__` to access parent parsed options.
|
42
|
+
PARENT = ParentKey.new
|
35
43
|
|
36
44
|
# Create a new command.
|
37
45
|
#
|
data/lib/gli/version.rb
CHANGED
data/test/tc_command.rb
CHANGED
@@ -40,8 +40,6 @@ class TC_testCommand < Clean::Test::TestCase
|
|
40
40
|
|
41
41
|
def test_basic_command
|
42
42
|
[false,true].each do |openstruct|
|
43
|
-
end
|
44
|
-
[true].each do |openstruct|
|
45
43
|
create_app(openstruct)
|
46
44
|
openstruct_message = openstruct ? ", with use_openstruct" : ""
|
47
45
|
args_args = [%w(-g basic -v -c foo bar baz quux), %w(-g basic -v --configure=foo bar baz quux)]
|
@@ -61,6 +59,12 @@ class TC_testCommand < Clean::Test::TestCase
|
|
61
59
|
end
|
62
60
|
end
|
63
61
|
|
62
|
+
def test_openstruct_with_nested_commands
|
63
|
+
create_app(true)
|
64
|
+
@app.run(["top","nested"])
|
65
|
+
assert(!@error_called,"Error block should not have been called: #{@exception_caught.inspect}")
|
66
|
+
end
|
67
|
+
|
64
68
|
def test_around_filter
|
65
69
|
@around_block_called = false
|
66
70
|
@app.around do |global_options, command, options, arguments, code|
|
@@ -459,9 +463,10 @@ class TC_testCommand < Clean::Test::TestCase
|
|
459
463
|
@pre_called = false
|
460
464
|
@post_called = false
|
461
465
|
@error_called = false
|
466
|
+
@exception_caught = nil
|
462
467
|
@app.pre { |g,c,o,a| @pre_called = true }
|
463
468
|
@app.post { |g,c,o,a| @post_called = true }
|
464
|
-
@app.on_error { |
|
469
|
+
@app.on_error { |exception| @error_called = true; @exception_caught = exception }
|
465
470
|
@glob = nil
|
466
471
|
@verbose = nil
|
467
472
|
@glob_verbose = nil
|
@@ -503,6 +508,14 @@ class TC_testCommand < Clean::Test::TestCase
|
|
503
508
|
@app.command [:test_wrap] do |c|
|
504
509
|
c.action {}
|
505
510
|
end
|
511
|
+
|
512
|
+
@app.desc "A top-level command"
|
513
|
+
@app.command [:top] do |c|
|
514
|
+
c.desc "A nested command"
|
515
|
+
c.command [:nested] do |nested|
|
516
|
+
nested.action {}
|
517
|
+
end
|
518
|
+
end
|
506
519
|
end
|
507
520
|
|
508
521
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.17.
|
4
|
+
version: 2.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Copeland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|