cri 2.15.8 → 2.15.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/NEWS.md +6 -0
- data/lib/cri/command.rb +5 -1
- data/lib/cri/version.rb +1 -1
- data/test/test_command.rb +37 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4401ab0bc18e9f1603e6de169020202c419a49b25c4afac97e979d60bc866ef3
|
4
|
+
data.tar.gz: eb540e18c8a84d7b8fbfb2b995c538f668455a0d13d90557ea3ac404c66eb17e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2fd32fe7476d4be56325e8911372a41c7048627bac07d7eae5fa847e82a4994c00d244c84ccfd5335c18e957ab49be79eb54746125141106c0d1fc88f62a8b1
|
7
|
+
data.tar.gz: 97d558d0037d6a90ba758e42b0777c2060a91df46b8d773ba04c35f53a5f1d4db3da8372dfd1e24c6cbf2a4960e7607c77f0ed322335d59c0fd68e73f9cb259e
|
data/Gemfile.lock
CHANGED
data/NEWS.md
CHANGED
data/lib/cri/command.rb
CHANGED
@@ -361,7 +361,11 @@ module Cri
|
|
361
361
|
end
|
362
362
|
|
363
363
|
def all_opt_defns
|
364
|
-
|
364
|
+
if supercommand
|
365
|
+
supercommand.all_opt_defns | option_definitions
|
366
|
+
else
|
367
|
+
option_definitions
|
368
|
+
end
|
365
369
|
end
|
366
370
|
|
367
371
|
# @return [String] The help text for this command
|
data/lib/cri/version.rb
CHANGED
data/test/test_command.rb
CHANGED
@@ -963,5 +963,42 @@ module Cri
|
|
963
963
|
assert_equal ['Animal = cow'], lines(out)
|
964
964
|
assert_equal [], lines(err)
|
965
965
|
end
|
966
|
+
|
967
|
+
def test_option_definitions_are_not_shared_across_commands
|
968
|
+
root_cmd = Cri::Command.define do
|
969
|
+
name 'root'
|
970
|
+
option :r, :rrr, 'Rrr!', argument: :required
|
971
|
+
end
|
972
|
+
|
973
|
+
subcmd_a = root_cmd.define_command do
|
974
|
+
name 'a'
|
975
|
+
option :a, :aaa, 'Aaa!', argument: :required
|
976
|
+
|
977
|
+
run do |_opts, _args, cmd|
|
978
|
+
puts cmd.all_opt_defns.map(&:long).sort.join(',')
|
979
|
+
end
|
980
|
+
end
|
981
|
+
|
982
|
+
subcmd_b = root_cmd.define_command do
|
983
|
+
name 'b'
|
984
|
+
option :b, :bbb, 'Bbb!', argument: :required
|
985
|
+
|
986
|
+
run do |_opts, _args, cmd|
|
987
|
+
puts cmd.all_opt_defns.map(&:long).sort.join(',')
|
988
|
+
end
|
989
|
+
end
|
990
|
+
|
991
|
+
out, err = capture_io_while do
|
992
|
+
subcmd_a.run(%w[])
|
993
|
+
end
|
994
|
+
assert_equal ['aaa,rrr'], lines(out)
|
995
|
+
assert_equal [], lines(err)
|
996
|
+
|
997
|
+
out, err = capture_io_while do
|
998
|
+
subcmd_b.run(%w[])
|
999
|
+
end
|
1000
|
+
assert_equal ['bbb,rrr'], lines(out)
|
1001
|
+
assert_equal [], lines(err)
|
1002
|
+
end
|
966
1003
|
end
|
967
1004
|
end
|