Skip to content

Commit

Permalink
Preparing for 1.44 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ttscoff committed Jan 24, 2023
1 parent db055f1 commit 8be5ed8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Brett's PopClip Extensions

My growing collection of [PopClip][popclip] extensions.

_Current release version: **1.43** ([source code](https://github.com/ttscoff/popclipextensions/releases/tag/1.43))_
_Current release version: **1.44** ([source code](https://github.com/ttscoff/popclipextensions/releases/tag/1.44))_

## Installation

Expand Down
17 changes: 9 additions & 8 deletions SearchLink.popclipext/searchlink.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'shellwords'

input = ENV['POPCLIP_TEXT']

def install_searchlink
unless File.exist?(File.expand_path('~/Library/Services/SearchLink.workflow'))
folder = File.expand_path('~/Downloads')
services = File.expand_path('~/Library/Services')
user = `whoami`.strip
unless File.exist?(File.expand_path("/Users/#{user}/Library/Services/SearchLink.workflow"))
folder = File.expand_path("/Users/#{user}/Downloads")
services = File.expand_path("/Users/#{user}/Library/Services")
dl = File.join(folder, 'SearchLink.zip')
`curl -SsL -o "#{dl}" https://github.com/ttscoff/searchlink/releases/latest/download/SearchLink.zip`
Dir.chdir(folder)
Expand All @@ -16,18 +19,16 @@ def install_searchlink
['SearchLink.workflow', 'SearchLink File.workflow', 'Jump to SearchLink Error.workflow'].each do |wflow|
src = File.join(folder, 'SearchLink Services', wflow)
dest = File.join(services, wflow)
if File.exist?(src) && File.exist?(dest)
FileUtils.rm_rf(dest)
end
FileUtils.rm_rf(dest) if File.exist?(dest)
FileUtils.mv(src, dest, force: true)
end
FileUtils.rm_rf('SearchLink Services')
end
end

install_searchlink

res = `echo #{Shellwords.escape(input)} | automator -i - ~/Library/Services/SearchLink.workflow`.strip
user = `whoami`.strip
res = `echo #{Shellwords.escape(input)} | automator -i - /Users/#{user}/Library/Services/SearchLink.workflow`.strip

res.gsub!(/'/, "\\\\'")
res.gsub!(/^\(/, '[')
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.43
1.44

0 comments on commit 8be5ed8

Please sign in to comment.