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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cl/help/cmd.rb +9 -4
- data/lib/cl/helper/suggest.rb +2 -4
- data/lib/cl/opt.rb +1 -1
- data/lib/cl/parser.rb +0 -1
- data/lib/cl/version.rb +1 -1
- 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: dacd4d093f0970d4eb5302ff5f4f8bf4d73c69245f38ec544eb764a30c6a8e46
|
4
|
+
data.tar.gz: 9d11eaa2671ba6ffe6cfdc534bfd0eae620f30e40720f4567d942cfce4c47dca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 745f6a9f4009f75af3d5714436925cd1d8df5a4556e566b2d2edde8f5b86bb56cd064aeab11cde914326a6bde8a7d5e7ed57adea164aa1cfa4e99e8680e3d4a8
|
7
|
+
data.tar.gz: '0097968b0b4cfdf6098cb74b5cf44b797628c3e250559b249ced2baa5c30c16ced5d76536a38cbfe0687e95ca08d197a709b8a7eefa778bda2e8f99ec5e64fd6'
|
data/Gemfile.lock
CHANGED
data/lib/cl/help/cmd.rb
CHANGED
@@ -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
|
77
|
+
opts.push(negate?(opt) ? negate(opt) : opt.long)
|
78
78
|
opts.compact
|
79
79
|
end
|
80
80
|
|
81
|
-
def negate(opt
|
82
|
-
negations =
|
83
|
-
opt.
|
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
|
data/lib/cl/helper/suggest.rb
CHANGED
@@ -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
|
data/lib/cl/opt.rb
CHANGED
data/lib/cl/parser.rb
CHANGED
data/lib/cl/version.rb
CHANGED