hotdog 0.27.1 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hotdog/application.rb +4 -1
- data/lib/hotdog/formatters/json.rb +6 -2
- data/lib/hotdog/version.rb +1 -1
- data/spec/formatter/json_spec.rb +15 -20
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 767a3a461352d6a061a8a7541c63485b8aa93a82
|
4
|
+
data.tar.gz: d10b581aefae9b078c25560de2eac8f7102cdb36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d448f39a939e75d2063e435b6b883d5fc9b77b13070a7d7478505201cfad1e8f36fcce91b5088323fff2a7ba6bcfb1bcc44ae164804b1e6149983bd3c8f983e0
|
7
|
+
data.tar.gz: 130e2134cb73948d096006ac9b2443be9a0f3ceafae62c4fd6c004337e5ee697bd2327cd45ba53d4eceaacd8938e21067cb2bd5166b8117ac5d96dc867a55f29
|
data/lib/hotdog/application.rb
CHANGED
@@ -231,10 +231,13 @@ module Hotdog
|
|
231
231
|
@optparse.on("--primary-tag TAG", "Use specified tag as the primary tag") do |tag|
|
232
232
|
options[:primary_tag] = tag
|
233
233
|
end
|
234
|
+
@optparse.on("-q", "--[no-]quiet", "Decrease verbosity") do |v|
|
235
|
+
options[:verbosity] -= 1
|
236
|
+
end
|
234
237
|
@optparse.on("-x", "--display-search-tags", "Show tags used in search expression") do |v|
|
235
238
|
options[:display_search_tags] = v
|
236
239
|
end
|
237
|
-
@optparse.on("-V", "-v", "--[no-]verbose", "
|
240
|
+
@optparse.on("-V", "-v", "--[no-]verbose", "Increase verbosity") do |v|
|
238
241
|
options[:verbosity] += 1
|
239
242
|
end
|
240
243
|
@optparse.on("--[no-]offline", "Enable offline mode") do |v|
|
@@ -8,9 +8,13 @@ module Hotdog
|
|
8
8
|
def format(result, options={})
|
9
9
|
result = prepare(result)
|
10
10
|
if options[:headers] and options[:fields]
|
11
|
-
result.
|
11
|
+
result.map! do |record|
|
12
|
+
Hash[options[:fields].zip(record)]
|
13
|
+
end
|
14
|
+
JSON.pretty_generate(result) + newline
|
15
|
+
else
|
16
|
+
JSON.pretty_generate(result) + newline
|
12
17
|
end
|
13
|
-
JSON.pretty_generate(result) + newline
|
14
18
|
end
|
15
19
|
end
|
16
20
|
end
|
data/lib/hotdog/version.rb
CHANGED
data/spec/formatter/json_spec.rb
CHANGED
@@ -40,26 +40,21 @@ describe "json" do
|
|
40
40
|
}
|
41
41
|
expect(fmt.format([["foo", "aaa", 1], ["bar", "bbb", 2], ["baz", "ccc", 3]], options)).to eq(<<-EOS)
|
42
42
|
[
|
43
|
-
|
44
|
-
"key1",
|
45
|
-
"key2",
|
46
|
-
"val1"
|
47
|
-
|
48
|
-
|
49
|
-
"
|
50
|
-
"
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
"
|
55
|
-
"
|
56
|
-
|
57
|
-
|
58
|
-
[
|
59
|
-
"baz",
|
60
|
-
"ccc",
|
61
|
-
3
|
62
|
-
]
|
43
|
+
{
|
44
|
+
"key1": "foo",
|
45
|
+
"key2": "aaa",
|
46
|
+
"val1": 1
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"key1": "bar",
|
50
|
+
"key2": "bbb",
|
51
|
+
"val1": 2
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"key1": "baz",
|
55
|
+
"key2": "ccc",
|
56
|
+
"val1": 3
|
57
|
+
}
|
63
58
|
]
|
64
59
|
EOS
|
65
60
|
end
|
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.
|
4
|
+
version: 0.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yamashita Yuu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|