cl 1.1.3 → 1.1.4

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
- SHA256:
3
- metadata.gz: 023c11a89274f2bdacc6ce33042df713e9fdf4cf4a65570e1d27499f733f993c
4
- data.tar.gz: f6446a52bfc1f52d4733249690fc8e8a67b18b110a2e283a2756a829be11e26b
2
+ SHA1:
3
+ metadata.gz: 26f8cc7cff92e13041e0ed0226f7a82611edcce9
4
+ data.tar.gz: dfb29e02b7b5fc6603014a2c6173b670edb4381b
5
5
  SHA512:
6
- metadata.gz: 80508a712619113a2a6d7b95c73e45c5584f14432f5dc93a6196e18f1a82eafd17607f0ec0e74c094a5c1ba1d0bc2b4911c1b46aaec2ca9d87979320e40ad6bd
7
- data.tar.gz: f5e53adf26746f03386e1270945935b0f58012f62c36fa04dbaa1179fb1fb4e0250fcb305adab85cdafa5757ada6af27fe2ace1133881574ce550800861ac8d9
6
+ metadata.gz: 31910ad936da411660ba47e6e953b8e6b9aadc6895e931eeb58d1d7900f5fbfa8854a5f65158c75757f2d77c9d128f9906d67c036b174f23128d5a05a6dd51fc
7
+ data.tar.gz: 5dbbe239c4dd16da3b0797e40fae8adc26c85882b8566aa30b74100c9a29dc275b6a12b9524968787153efdc6cbc2af05564031a2f3d4a94508bd9ec2bbef77f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.3 (2019-09-02)
4
+
5
+ * Rescue OptionParser::InvalidOption, suggest known options
6
+
7
+ ## 1.1.2 (2019-09-02)
8
+
9
+ * Fix deprecations for underscored keys
10
+
11
+ ## 1.1.1 (2019-08-26)
12
+
13
+ * Fix an issue in opt.deprecated?(name)
14
+
15
+ ## 1.1.0 (2019-08-26)
16
+
17
+ * Add suggestions on unknown cmds and enums
18
+ * Validate option options
19
+
3
20
  ## 1.0.5 (2019-08-18)
4
21
 
5
22
  ### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cl (1.1.2)
4
+ cl (1.1.3)
5
5
  regstry (~> 1.0.3)
6
6
 
7
7
  GEM
data/lib/cl.rb CHANGED
@@ -46,6 +46,7 @@ class Cl
46
46
  # Returns help output for the given command
47
47
  def help(*args)
48
48
  runner(['help', *args]).cmd.help
49
+ rescue
49
50
  end
50
51
 
51
52
  private
data/lib/cl/cmd.rb CHANGED
@@ -20,7 +20,11 @@ class Cl
20
20
  include Merge, Suggest, Underscore
21
21
 
22
22
  inherited = ->(const) do
23
- const.register [registry_key, underscore(const.name.split('::').last)].compact.join(':') if const.name
23
+ if const.name
24
+ key = underscore(const.name.split('::').last)
25
+ key = [registry_key, key].compact.join(':') unless abstract?
26
+ end
27
+ const.register key
24
28
  const.define_singleton_method(:inherited, &inherited)
25
29
  end
26
30
  define_method(:inherited, &inherited)
@@ -41,6 +45,8 @@ class Cl
41
45
  end
42
46
  end
43
47
 
48
+ abstract
49
+
44
50
  opt '--help', 'Get help on this command'
45
51
 
46
52
  attr_reader :ctx, :args
data/lib/cl/dsl.rb CHANGED
@@ -7,6 +7,11 @@ class Cl
7
7
 
8
8
  def abstract
9
9
  unregister
10
+ @abstract = true
11
+ end
12
+
13
+ def abstract?
14
+ !!@abstract
10
15
  end
11
16
 
12
17
  # Declare multiple arguments at once
@@ -70,7 +70,7 @@ class Cl
70
70
  end
71
71
 
72
72
  cmd, keys = keys[0].last
73
- raise UnknownCmd.new(self, args) unless cmd
73
+ raise UnknownCmd.new(self, args) if cmd.nil? || cmd.abstract?
74
74
  keys.each { |key| args.delete_at(args.index(key)) }
75
75
  [cmd, args]
76
76
  end
data/lib/cl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Cl
2
- VERSION = '1.1.3'
2
+ VERSION = '1.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Fuchs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-02 00:00:00.000000000 Z
11
+ date: 2019-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: regstry
@@ -170,7 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubygems_version: 3.0.3
173
+ rubyforge_project:
174
+ rubygems_version: 2.6.13
174
175
  signing_key:
175
176
  specification_version: 4
176
177
  summary: Object-oriented OptionParser based CLI support