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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8133dfa33226ec959daeea2060f7efc15672e642d6a9afb8c19d9e3fabd550ce
4
- data.tar.gz: 5c2c3afb7da1a9ad6adff22b136cd0cea144bb8b8e451bf0b3f50849bac10c90
3
+ metadata.gz: 4401ab0bc18e9f1603e6de169020202c419a49b25c4afac97e979d60bc866ef3
4
+ data.tar.gz: eb540e18c8a84d7b8fbfb2b995c538f668455a0d13d90557ea3ac404c66eb17e
5
5
  SHA512:
6
- metadata.gz: 4ce23dee547462ed7d5a2f5618250019f520663c0bcdd2ce4a83cdf4a69dbfebc90a22cc61368a512a250fe2960a0a452e8c40dc65cd71afdae6f249cfe3095b
7
- data.tar.gz: a471a0036ced17f51a6acef3b9e04239c74cfca8a024b76bd97837c9fc19182739165412e31021d1371875cc6fcfcc55c71cdd5983e9c4208d2555160182e418
6
+ metadata.gz: d2fd32fe7476d4be56325e8911372a41c7048627bac07d7eae5fa847e82a4994c00d244c84ccfd5335c18e957ab49be79eb54746125141106c0d1fc88f62a8b1
7
+ data.tar.gz: 97d558d0037d6a90ba758e42b0777c2060a91df46b8d773ba04c35f53a5f1d4db3da8372dfd1e24c6cbf2a4960e7607c77f0ed322335d59c0fd68e73f9cb259e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cri (2.15.8)
4
+ cri (2.15.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/NEWS.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Cri News
2
2
 
3
+ ## 2.15.9
4
+
5
+ Fixes:
6
+
7
+ * Fixed bug which could cause options from one command appear in other commands (#101, #102)
8
+
3
9
  ## 2.15.8
4
10
 
5
11
  Fixes:
@@ -361,7 +361,11 @@ module Cri
361
361
  end
362
362
 
363
363
  def all_opt_defns
364
- supercommand ? supercommand.all_opt_defns.merge(option_definitions) : option_definitions
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Cri
4
4
  # The current Cri version.
5
- VERSION = '2.15.8'
5
+ VERSION = '2.15.9'
6
6
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cri
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.8
4
+ version: 2.15.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne