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 +4 -4
- data/CHANGELOG.md +21 -17
- data/lib/bogo-cli/command.rb +20 -1
- data/lib/bogo-cli/setup.rb +1 -1
- data/lib/bogo-cli/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceca5c4fb8db77d050512dc0742b207e1e8ab395
|
4
|
+
data.tar.gz: 12ba4aa9b6f7133cc57471461953f1d9c94a4594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e782020d834bce7d662ca89bd04828b826dab384fdbf152d155b2a24f98b45237231d3637c59de157917b802ef84a17a77efe2c68bb4bdb651e75c403e12567
|
7
|
+
data.tar.gz: a6f2a61a68f346c6092ea2dbb4355ecbd28f9311536da6aff11ded6a9d1444a7c1bc4d422c25c9d6496a9801fae71b07fbf637c6e76ffd85f48ef0bbaab114b7
|
data/CHANGELOG.md
CHANGED
@@ -1,64 +1,68 @@
|
|
1
|
-
|
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
|
-
|
9
|
+
# v0.1.30
|
6
10
|
* Trap and shutdown on TERM signal (mimic INT behavior)
|
7
11
|
|
8
|
-
|
12
|
+
# v0.1.28
|
9
13
|
* [hotfix] Resolve default option merging
|
10
14
|
* Include spec coverage for missed code path
|
11
15
|
|
12
|
-
|
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
|
-
|
20
|
+
# v0.1.24
|
17
21
|
* [fix] Remove configuration items with `nil` values
|
18
22
|
|
19
|
-
|
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
|
-
|
27
|
+
# v0.1.20
|
24
28
|
* Bug fix on command initialization when options provided are Hash-like
|
25
29
|
|
26
|
-
|
30
|
+
# v0.1.18
|
27
31
|
* Remove nil value items from namespaced options hash prior to merge
|
28
32
|
|
29
|
-
|
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
|
-
|
39
|
+
# v0.1.14
|
36
40
|
* Merge namespaced opts with globals when providing options to allow full config load
|
37
41
|
|
38
|
-
|
42
|
+
# v0.1.12
|
39
43
|
* Add `Bogo::Cli#config` method that merges `#options` with `#opts`
|
40
44
|
|
41
|
-
|
45
|
+
# v0.1.10
|
42
46
|
* Pass namespaced configuration through to UI
|
43
47
|
|
44
|
-
|
48
|
+
# v0.1.8
|
45
49
|
* Always load bogo-config
|
46
50
|
|
47
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
67
|
+
# v0.1.0
|
64
68
|
* Initial release
|
data/lib/bogo-cli/command.rb
CHANGED
@@ -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
|
data/lib/bogo-cli/setup.rb
CHANGED
@@ -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
|
data/lib/bogo-cli/version.rb
CHANGED
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.
|
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:
|
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:
|