hiiro 0.1.15 → 0.1.16
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/bin/h-link +20 -1
- data/lib/hiiro/version.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: 79ae7c6943bffba4ffb21c734c699946ec9ee43eb247e8dc1e77532f9fe8b506
|
|
4
|
+
data.tar.gz: 18b3196492b5f9838dabd1cb8085d3184b2798aac27799f28ae114a497025284
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce091b64e298217a27dcd291906e0cd9284ada1ab9654d257632d062c575af95466d06f874328e0f02cce4db17e4d096ab3663763c170952d4d7fe29c3b96ad7
|
|
7
|
+
data.tar.gz: dcc6e3a169b876aaf9f16e6cb7173eda73a71700869bd13e683be87d5f7b6fd56608868f79cff5cb377f448d5334122e947cf232d1321923ad68e669641820fb
|
data/bin/h-link
CHANGED
|
@@ -39,9 +39,15 @@ def hash_matches?(links, *args)
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def
|
|
42
|
+
def search_links(links, *args)
|
|
43
43
|
terms = args.map(&:downcase)
|
|
44
44
|
|
|
45
|
+
links.select do |link|
|
|
46
|
+
link_matches?(link, *terms)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def link_matches?(link, *terms)
|
|
45
51
|
searchable = [
|
|
46
52
|
link['url'],
|
|
47
53
|
link['description'],
|
|
@@ -234,6 +240,8 @@ o.add_subcmd(:open) do |*args|
|
|
|
234
240
|
if args.empty?
|
|
235
241
|
lines = load_link_hash(links)
|
|
236
242
|
|
|
243
|
+
exit_code = 1
|
|
244
|
+
|
|
237
245
|
if args.any?
|
|
238
246
|
lines = hash_matches?(lines, *args)
|
|
239
247
|
end
|
|
@@ -244,12 +252,23 @@ o.add_subcmd(:open) do |*args|
|
|
|
244
252
|
if status.success? && !selected.strip.empty?
|
|
245
253
|
if selected =~ /^\s*(\d+)\.\s+(\S+)/
|
|
246
254
|
system('open', $2)
|
|
255
|
+
exit_code = 0
|
|
247
256
|
end
|
|
248
257
|
end
|
|
258
|
+
|
|
259
|
+
exit exit_code
|
|
249
260
|
end
|
|
250
261
|
|
|
251
262
|
idx, link = find_link_by_ref(args.first, links)
|
|
252
263
|
|
|
264
|
+
if link.nil?
|
|
265
|
+
matches = search_links(links, *args)
|
|
266
|
+
|
|
267
|
+
if matches.count == 1
|
|
268
|
+
link = matches.first
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
253
272
|
if link.nil?
|
|
254
273
|
puts "Link not found: #{args.first}"
|
|
255
274
|
exit 1
|
data/lib/hiiro/version.rb
CHANGED