Method: HookApp#delete_hooks
- Defined in:
- lib/hook/hookapp.rb
#delete_hooks(args, opts) ⇒ Object
Delete hooks between two files/urls
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/hook/hookapp.rb', line 425 def delete_hooks(args, opts) urls = args.map(&:valid_hook).delete_if { |url| !url } output = [] if opts[:all] urls.each_with_index do |url, i| raise "Invalid target: #{args[i]}" unless url output.push(delete_all_hooks(url, force: opts[:force])) end return output.join("\n") end if urls.length == 2 source = urls[0] target = urls[1] `osascript <<'APPLESCRIPT' tell application "#{HOOK_APP}" set _mark1 to make bookmark with data "#{source}" set _mark2 to make bookmark with data "#{target}" unhook _mark1 and _mark2 return true end tell APPLESCRIPT` "Hook removed between #{source} and #{target}" else raise 'Invalid number of URLs or files specified' end end |