bogo-cli 0.1.32 → 0.2.0

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
  SHA1:
3
- metadata.gz: d2540114ae7a14349139d252eb4ddd284c9f27ec
4
- data.tar.gz: f4003172f6d8c64c87d72815ed41a6dc38af9e10
3
+ metadata.gz: ceca5c4fb8db77d050512dc0742b207e1e8ab395
4
+ data.tar.gz: 12ba4aa9b6f7133cc57471461953f1d9c94a4594
5
5
  SHA512:
6
- metadata.gz: 261c852566e3588ee7907f2abc015fdb09cee304c7e7759d8541e1291035e2f52a6e9740c663f4183aa5bb3840d877671092eb1682d0e748736b974d39dd3532
7
- data.tar.gz: 09cc190c1d47ce27ed762a908b8292dc555c609221156510b1d090e055c489640a6d2a5d7d27be545fe4135f815ab3db9a558e05cbc06132a9d9b04f0ca225ff
6
+ metadata.gz: 7e782020d834bce7d662ca89bd04828b826dab384fdbf152d155b2a24f98b45237231d3637c59de157917b802ef84a17a77efe2c68bb4bdb651e75c403e12567
7
+ data.tar.gz: a6f2a61a68f346c6092ea2dbb4355ecbd28f9311536da6aff11ded6a9d1444a7c1bc4d422c25c9d6496a9801fae71b07fbf637c6e76ffd85f48ef0bbaab114b7
data/CHANGELOG.md CHANGED
@@ -1,64 +1,68 @@
1
- ## v0.1.32
1
+ # v0.2.0
2
+ * Include full exception message when debug mode enabled
3
+ * Process arguments and check for flags within list
4
+
5
+ # v0.1.32
2
6
  * Run previous registered trap if provided
3
7
  * Allow clean exit or exception raise in main thread on signal
4
8
 
5
- ## v0.1.30
9
+ # v0.1.30
6
10
  * Trap and shutdown on TERM signal (mimic INT behavior)
7
11
 
8
- ## v0.1.28
12
+ # v0.1.28
9
13
  * [hotfix] Resolve default option merging
10
14
  * Include spec coverage for missed code path
11
15
 
12
- ## v0.1.26
16
+ # v0.1.26
13
17
  * Properly merge user provided options on top of defaults
14
18
  * Add helper method for determining if option is set as default
15
19
 
16
- ## v0.1.24
20
+ # v0.1.24
17
21
  * [fix] Remove configuration items with `nil` values
18
22
 
19
- ## v0.1.22
23
+ # v0.1.22
20
24
  * Add `Bogo::Cli#config_class` to specify custom `Bogo::Config`
21
25
  * Always load provided args through config
22
26
 
23
- ## v0.1.20
27
+ # v0.1.20
24
28
  * Bug fix on command initialization when options provided are Hash-like
25
29
 
26
- ## v0.1.18
30
+ # v0.1.18
27
31
  * Remove nil value items from namespaced options hash prior to merge
28
32
 
29
- ## v0.1.16
33
+ # v0.1.16
30
34
  * Output exception message when reporting error to get full content
31
35
  * Trap INT to allow nicer user forced exits
32
36
  * Automatically exit after command block is run
33
37
  * Print help message and exit non-zero when no command is run
34
38
 
35
- ## v0.1.14
39
+ # v0.1.14
36
40
  * Merge namespaced opts with globals when providing options to allow full config load
37
41
 
38
- ## v0.1.12
42
+ # v0.1.12
39
43
  * Add `Bogo::Cli#config` method that merges `#options` with `#opts`
40
44
 
41
- ## v0.1.10
45
+ # v0.1.10
42
46
  * Pass namespaced configuration through to UI
43
47
 
44
- ## v0.1.8
48
+ # v0.1.8
45
49
  * Always load bogo-config
46
50
 
47
- ## v0.1.6
51
+ # v0.1.6
48
52
  * Remove options when value is nil (fixes merging issues)
49
53
  * Proxy options to Ui instance when building
50
54
  * Rescue ScriptError explicitly as it's not within StandardError
51
55
 
52
- ## v0.1.4
56
+ # v0.1.4
53
57
  * Force passed options to Hash type and covert to Smash
54
58
  * Force passed options keys to snake case
55
59
  * Include slim error message on unexpected errors when not in debug
56
60
 
57
- ## v0.1.2
61
+ # v0.1.2
58
62
  * Add version restriction to slop
59
63
  * Allow usage of pre-built Ui instance
60
64
  * Provide automatic output of hash or string for truthy results
61
65
  * Add initial spec coverage
62
66
 
63
- ## v0.1.0
67
+ # v0.1.0
64
68
  * Initial release
@@ -32,7 +32,7 @@ module Bogo
32
32
  hsh.delete_if{|k,v| v.nil?}
33
33
  end
34
34
  end
35
- @arguments = args
35
+ @arguments = validate_arguments!(args)
36
36
  ui_args = Smash.new(
37
37
  :app_name => options.fetch(:app_name,
38
38
  self.class.name.split('::').first
@@ -169,6 +169,25 @@ module Bogo
169
169
  nil
170
170
  end
171
171
 
172
+ # Check for flags within argument list
173
+ #
174
+ # @param list [Array<String>]
175
+ # @return [Array<String>]
176
+ def validate_arguments!(list)
177
+ chk_idx = list.find_index do |item|
178
+ item.start_with?('-')
179
+ end
180
+ if(chk_idx)
181
+ marker = list.find_index do |item|
182
+ item == '--'
183
+ end
184
+ if(marker.nil? || chk_idx.to_i < marker)
185
+ raise ArgumentError.new "Unknown CLI option provided `#{list[chk_idx]}`"
186
+ end
187
+ end
188
+ list
189
+ end
190
+
172
191
  end
173
192
 
174
193
  end
@@ -52,7 +52,7 @@ module Bogo
52
52
  exit -1
53
53
  rescue StandardError, ScriptError => e
54
54
  if(ENV['DEBUG'])
55
- $stderr.puts "ERROR: #{e.class}: #{e}\n#{e.backtrace.join("\n")}"
55
+ $stderr.puts "ERROR: #{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
56
56
  else
57
57
  $stderr.puts "ERROR: #{e.class}: #{e.message}"
58
58
  end
@@ -1,6 +1,6 @@
1
1
  module Bogo
2
2
  module Cli
3
3
  # Current library version
4
- VERSION = Gem::Version.new('0.1.32')
4
+ VERSION = Gem::Version.new('0.2.0')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bogo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-24 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo
@@ -106,3 +106,4 @@ signing_key:
106
106
  specification_version: 4
107
107
  summary: CLI Helper libraries
108
108
  test_files: []
109
+ has_rdoc: