hotdog 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hotdog/commands/search.rb +12 -3
- data/lib/hotdog/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4fb9028929d4aa082b3fce15dc07c0027b27bfc
|
4
|
+
data.tar.gz: 6f2130f9703ac12a68ccbe5e6689e9fb3eb031fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d089ed09d65c01eb076751d1ac0d83f977eb933ba0ee3af907bb7e7865d7cc73754fff88bd0798fa726b0c4e88e5ddac17b9cf9e0efb19c8f15324e04bfc994a
|
7
|
+
data.tar.gz: f2f37b92ee3b1c8ee7dc503cd434c5ce07fb0345eab67d1d901b16f9d5a37b5df8533577bd7c103a231aabd2f917ac9e79ef374eb92a0e6b3013990adc83c2b4
|
@@ -7,6 +7,11 @@ module Hotdog
|
|
7
7
|
module Commands
|
8
8
|
class Search < BaseCommand
|
9
9
|
def run(args=[])
|
10
|
+
search_options = {
|
11
|
+
}
|
12
|
+
optparse.on("-n", "--limit LIMIT", "Limit result set to specified size at most", Integer) do |limit|
|
13
|
+
search_options[:limit] = limit
|
14
|
+
end
|
10
15
|
args = optparse.parse(args)
|
11
16
|
expression = args.join(" ").strip
|
12
17
|
if expression.empty?
|
@@ -22,9 +27,14 @@ module Hotdog
|
|
22
27
|
|
23
28
|
result = evaluate(node, self).sort
|
24
29
|
if 0 < result.length
|
25
|
-
|
30
|
+
_result, fields = get_hosts_with_search_tags(result, node)
|
31
|
+
result = _result.take(search_options.fetch(:limit, _result.size))
|
26
32
|
STDOUT.print(format(result, fields: fields))
|
27
|
-
|
33
|
+
if _result.length == result.length
|
34
|
+
logger.info("found %d host(s)." % result.length)
|
35
|
+
else
|
36
|
+
logger.info("found %d host(s), limited to %d in result." % [_result.length, result.length])
|
37
|
+
end
|
28
38
|
else
|
29
39
|
STDERR.puts("no match found: #{args.join(" ")}")
|
30
40
|
exit(1)
|
@@ -296,7 +306,6 @@ module Hotdog
|
|
296
306
|
INNER JOIN hosts ON hosts_tags.host_id = hosts.id
|
297
307
|
INNER JOIN tags ON hosts_tags.tag_id = tags.id
|
298
308
|
WHERE LOWER(hosts.name) GLOB LOWER(?) OR LOWER(tags.name) GLOB LOWER(?) OR LOWER(tags.value) GLOB LOWER(?);
|
299
|
-
|
300
309
|
EOS
|
301
310
|
end
|
302
311
|
if not environment.fixed_string? and values.empty?
|
data/lib/hotdog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotdog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yamashita Yuu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,9 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.4.5
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: Yet another command-line tool for Datadog
|
156
156
|
test_files: []
|
157
|
-
has_rdoc:
|