curlyq 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/bin/curlyq +2 -2
- data/lib/curly/version.rb +1 -1
- data/src/_README.md +1 -1
- data/test/curlyq_html_test.rb +1 -1
- data/test/curlyq_json_test.rb +4 -4
- data/test/helpers/threaded_tests.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92b27e3065435d17fd5d6129bd640481dee8acf66f9ed82b2b68ae6a7589f463
|
4
|
+
data.tar.gz: a5cd5299248fd01d8f12a80a1c9982de4f8e0160ea5033ab96b60677bb9ea2c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1348b97fdf89faf44cd0cfc0f2aecc05a679606f19fe57392d588209da26fc3a5c2407569173d41e1497bdf409d762adee0d2533089b5ce27854e298fe98cc13
|
7
|
+
data.tar.gz: c80ecd381e1d941d8e8e5ead0dd925682e26a2f8cc639f0202d5b5cd30f025582fc5d5a2665daca3e5e7d0f2099066d3ca3d9ad8ad00b07d2ee5673b122bae01
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ _If you find this useful, feel free to [buy me some coffee][donate]._
|
|
10
10
|
[donate]: https://brettterpstra.com/donate
|
11
11
|
|
12
12
|
|
13
|
-
The current version of `curlyq` is 0.0.
|
13
|
+
The current version of `curlyq` is 0.0.7
|
14
14
|
.
|
15
15
|
|
16
16
|
CurlyQ is a utility that provides a simple interface for curl, with additional features for things like extracting images and links, finding elements by CSS selector or XPath, getting detailed header info, and more. It's designed to be part of a scripting pipeline, outputting everything as structured data (JSON or YAML). It also has rudimentary support for making calls to JSON endpoints easier, but it's expected that you'll use something like `jq` to parse the output.
|
@@ -44,7 +44,7 @@ SYNOPSIS
|
|
44
44
|
curlyq [global options] command [command options] [arguments...]
|
45
45
|
|
46
46
|
VERSION
|
47
|
-
0.0.
|
47
|
+
0.0.7
|
48
48
|
|
49
49
|
GLOBAL OPTIONS
|
50
50
|
--help - Show this message
|
data/bin/curlyq
CHANGED
@@ -144,7 +144,7 @@ command %i[html curl] do |c|
|
|
144
144
|
end
|
145
145
|
output.delete_if(&:nil?)
|
146
146
|
output.delete_if(&:empty?)
|
147
|
-
output = output[0] if output.count == 1
|
147
|
+
# output = output[0] if output.count == 1
|
148
148
|
output.map! { |o| o[options[:raw].to_sym] } if options[:raw]
|
149
149
|
|
150
150
|
print_out(output, global_options[:yaml], raw: options[:raw], pretty: global_options[:pretty])
|
@@ -240,7 +240,7 @@ command :json do |c|
|
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
-
output = output[0] if output.count == 1
|
243
|
+
# output = output[0] if output.count == 1
|
244
244
|
|
245
245
|
print_out(output, global_options[:yaml], pretty: global_options[:pretty])
|
246
246
|
end
|
data/lib/curly/version.rb
CHANGED
data/src/_README.md
CHANGED
@@ -10,7 +10,7 @@ _If you find this useful, feel free to [buy me some coffee][donate]._
|
|
10
10
|
[donate]: https://brettterpstra.com/donate
|
11
11
|
<!--END GITHUB-->
|
12
12
|
|
13
|
-
The current version of `curlyq` is <!--VER-->0.0.
|
13
|
+
The current version of `curlyq` is <!--VER-->0.0.6<!--END VER-->.
|
14
14
|
|
15
15
|
CurlyQ is a utility that provides a simple interface for curl, with additional features for things like extracting images and links, finding elements by CSS selector or XPath, getting detailed header info, and more. It's designed to be part of a scripting pipeline, outputting everything as structured data (JSON or YAML). It also has rudimentary support for making calls to JSON endpoints easier, but it's expected that you'll use something like `jq` to parse the output.
|
16
16
|
|
data/test/curlyq_html_test.rb
CHANGED
@@ -12,7 +12,7 @@ class CurlyQHtmlTest < Test::Unit::TestCase
|
|
12
12
|
|
13
13
|
def test_html_search_query
|
14
14
|
result = curlyq('html', '-s', '#main article .aligncenter', '-q', 'images[1]', 'https://brettterpstra.com')
|
15
|
-
json = JSON.parse(result)
|
15
|
+
json = JSON.parse(result)[0]
|
16
16
|
|
17
17
|
assert_match(/aligncenter/, json[0]['class'], 'Should have found an image with class "aligncenter"')
|
18
18
|
end
|
data/test/curlyq_json_test.rb
CHANGED
@@ -13,9 +13,9 @@ class CurlyQJsonTest < Test::Unit::TestCase
|
|
13
13
|
def setup
|
14
14
|
end
|
15
15
|
|
16
|
-
def test_json
|
16
|
+
def test_json
|
17
17
|
result = curlyq('json', 'https://brettterpstra.com/scripts/giveaways_wrapper.cgi?v=203495&giveaway=hazel2023&action=count')
|
18
|
-
json = JSON.parse(result)
|
18
|
+
json = JSON.parse(result)[0]
|
19
19
|
|
20
20
|
assert_equal(json.class, Hash, 'Single result should be a hash')
|
21
21
|
assert_equal(286, json['json']['total'], 'json.total should match 286')
|
@@ -24,8 +24,8 @@ class CurlyQJsonTest < Test::Unit::TestCase
|
|
24
24
|
def test_query
|
25
25
|
result1 = curlyq('json', '-q', 'total', 'https://brettterpstra.com/scripts/giveaways_wrapper.cgi?v=203495&giveaway=hazel2023&action=count')
|
26
26
|
result2 = curlyq('json', '-q', 'json.total', 'https://brettterpstra.com/scripts/giveaways_wrapper.cgi?v=203495&giveaway=hazel2023&action=count')
|
27
|
-
json1 = JSON.parse(result1)
|
28
|
-
json2 = JSON.parse(result2)
|
27
|
+
json1 = JSON.parse(result1)[0]
|
28
|
+
json2 = JSON.parse(result2)[0]
|
29
29
|
|
30
30
|
assert_equal(286, json1, 'Should be 286')
|
31
31
|
assert_equal(286, json2, 'Including json in dot path should yeild same result')
|
@@ -132,7 +132,7 @@ class ThreadedTests
|
|
132
132
|
|
133
133
|
unless status.success? && !count['fails'].to_i.positive? && !count['errs'].to_i.positive?
|
134
134
|
s[2] = if count
|
135
|
-
": #{
|
135
|
+
": #{pastel.red(count['fails'])} #{pastel.red('failures')}, #{pastel.red(count['errs'])} #{pastel.red('errors')}"
|
136
136
|
else
|
137
137
|
": #{pastel.red('Unknown Error')}"
|
138
138
|
end
|