294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
# File 'lib/hook/hookapp.rb', line 294
def act_on(url)
= ['Open in default app']
return open_linked(url) unless File.exist?(url)
marks = get_hooks(url)
<< 'Browse file' if marks.count.positive?
args = ['--prompt="Choose action > "',
'--layout=reverse-list',
'--height=60%',
"--min-height=#{.count + 1}"]
sel = `echo #{Shellwords.escape(.join("\n"))} | '#{fzf}' #{args.join(' ')}`.chomp
return if sel.nil? || sel.empty?
case sel
when /Browse file/
browse_linked(url)
else
`open '#{url}'`
end
end
|