cl 1.1.0 → 1.1.1

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: 05d4a5fcd74cdf55dbf91276fdd200a5041c4aabef97ffa68849ad63b81b8d30
4
- data.tar.gz: 143667a25f93a57662f7271353815f9c6d253055aa45510f666fb37880cdda86
3
+ metadata.gz: dacd4d093f0970d4eb5302ff5f4f8bf4d73c69245f38ec544eb764a30c6a8e46
4
+ data.tar.gz: 9d11eaa2671ba6ffe6cfdc534bfd0eae620f30e40720f4567d942cfce4c47dca
5
5
  SHA512:
6
- metadata.gz: b3a7e08f7c2271b0932b424d66dde47d75c758b579f0fae714bfcd42addf7f2d0cd1a4412b156757071e079b14bb32e9fbd70e43b3fb7a056bfd8efa6e0ab554
7
- data.tar.gz: 3b32efded8658b8fce630613b3391157c9b295d8861b9000ed6fa679e8e7bb44904f34e474e6783399476c17dc4adbafd1552c050005f9df19f8323f77075247
6
+ metadata.gz: 745f6a9f4009f75af3d5714436925cd1d8df5a4556e566b2d2edde8f5b86bb56cd064aeab11cde914326a6bde8a7d5e7ed57adea164aa1cfa4e99e8680e3d4a8
7
+ data.tar.gz: '0097968b0b4cfdf6098cb74b5cf44b797628c3e250559b249ced2baa5c30c16ced5d76536a38cbfe0687e95ca08d197a709b8a7eefa778bda2e8f99ec5e64fd6'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cl (1.0.5)
4
+ cl (1.1.0)
5
5
  regstry (~> 1.0.3)
6
6
 
7
7
  GEM
@@ -74,13 +74,18 @@ class Cl
74
74
  def opt_strs(opt)
75
75
  return opt.strs if !opt.flag? || opt.help?
76
76
  opts = [opt.short]
77
- opts << negate(opt.long, opt.negate) if opt.long && opt.negate?
77
+ opts.push(negate?(opt) ? negate(opt) : opt.long)
78
78
  opts.compact
79
79
  end
80
80
 
81
- def negate(opt, negations)
82
- negations = negations.map { |str| "#{str}-" }.join('|')
83
- opt.dup.insert(2, "[#{negations}]")
81
+ def negate?(opt)
82
+ negations = opt.negate.map { |str| "#{str}-" }.join('|')
83
+ opt.long && opt.negate? && opt.long !~ /\[#{negations}\]/
84
+ end
85
+
86
+ def negate(opt)
87
+ negations = opt.negate.map { |str| "#{str}-" }.join('|')
88
+ opt.long.dup.insert(2, "[#{negations}]")
84
89
  end
85
90
 
86
91
  def requireds
@@ -1,11 +1,9 @@
1
1
  class Cl
2
2
  module Suggest
3
- include DidYouMean if defined?(DidYouMean)
4
-
5
3
  def suggest(dict, value)
6
- return [] unless defined?(DidYouMean)
4
+ return [] unless defined?(DidYouMean::SpellChecker)
7
5
  Array(value).map do |value|
8
- SpellChecker.new(dictionary: dict.map(&:to_s)).correct(value.to_s)
6
+ DidYouMean::SpellChecker.new(dictionary: dict.map(&:to_s)).correct(value.to_s)
9
7
  end.flatten
10
8
  end
11
9
  end
@@ -77,7 +77,7 @@ class Cl
77
77
  end
78
78
 
79
79
  def deprecated?(name = nil)
80
- name ? deprecated.first == name : !!opts[:deprecated]
80
+ name ? deprecated? && deprecated.first == name : !!opts[:deprecated]
81
81
  end
82
82
 
83
83
  def deprecated
@@ -18,7 +18,6 @@ class Cl
18
18
  end
19
19
  end
20
20
 
21
- orig = args.map(&:dup)
22
21
  @args = parse!(normalize(opts, args))
23
22
  end
24
23
 
@@ -1,3 +1,3 @@
1
1
  class Cl
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs