collins-cli 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/collins/cli/find.rb +7 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bad36aadb8185258a7c57b0ab4f907674d77c308
|
4
|
+
data.tar.gz: 8938fb0d0c72dc71d0912e5b663a93c28b192c5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f76e320e07236437849f200c4a3084e2815fccd287cc20e6fe079e9d084c23ea0c195e7a7595641d4df705dba230f5e631a3646019923d6bbb1814e2953ef57
|
7
|
+
data.tar.gz: f84991e817dbfb4f1245a76c0c447b63313016d8e788f5db20a10361b53fe156009d6ebe2720e1cd1cbcacd11d0b926a2010a1247a4dcde68248a9b3e6065a76
|
data/lib/collins/cli/find.rb
CHANGED
@@ -44,6 +44,7 @@ module Collins::CLI
|
|
44
44
|
opts.on('-n','--nodeclass NODECLASS[,...]',Array, "Assets in nodeclass NODECLASS") {|v| search_attrs[:nodeclass] = v}
|
45
45
|
opts.on('-p','--pool POOL[,...]',Array, "Assets in pool POOL") {|v| search_attrs[:pool] = v}
|
46
46
|
opts.on('-s','--size SIZE',Integer, "Number of assets to return per page (Default: #{query_opts[:size]})") {|v| query_opts[:size] = v}
|
47
|
+
opts.on('--limit NUM', Integer, "Limit total results to NUM of assets") { |v| options[:limit] = v}
|
47
48
|
opts.on('-r','--role ROLE[,...]',Array,"Assets in primary role ROLE") {|v| search_attrs[:primary_role] = v}
|
48
49
|
opts.on('-R','--secondary-role ROLE[,...]',Array,"Assets in secondary role ROLE") {|v| search_attrs[:secondary_role] = v}
|
49
50
|
opts.on('-i','--ip-address IP[,...]',Array,"Assets with IP address[es]") {|v| search_attrs[:ip_address] = v}
|
@@ -149,6 +150,7 @@ _EXAMPLES_
|
|
149
150
|
assets, res = [], []
|
150
151
|
begin
|
151
152
|
loop do
|
153
|
+
break if !options[:limit].nil? and assets.length >= options[:limit]
|
152
154
|
res = collins.find(query_opts.merge({:page => page}))
|
153
155
|
break if res.empty?
|
154
156
|
assets = assets.concat res
|
@@ -157,7 +159,11 @@ _EXAMPLES_
|
|
157
159
|
rescue => e
|
158
160
|
raise "Error querying collins: #{e.message}"
|
159
161
|
end
|
160
|
-
|
162
|
+
unless options[:limit].nil?
|
163
|
+
format_assets(assets.first(options[:limit]), options)
|
164
|
+
else
|
165
|
+
format_assets(assets, options)
|
166
|
+
end
|
161
167
|
end
|
162
168
|
true
|
163
169
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: collins-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Conradi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
120
120
|
- - '>='
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 1.9.
|
122
|
+
version: 1.9.3
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
125
|
- - '>='
|